diff --git a/slice_test.html b/slice_test.html
index 5b0cce7..f1d47c8 100644
--- a/slice_test.html
+++ b/slice_test.html
@@ -119,7 +119,7 @@ gcode = slicer.getGcode(printer);
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
-//var layer = 0;
+var layer = 0;
//var img = slicer.drawPaths(printer, layer, layer + 1);
//context.drawImage(img, 0, 0);
diff --git a/src/slicer.js b/src/slicer.js
index 36ca162..3a9b0fb 100644
--- a/src/slicer.js
+++ b/src/slicer.js
@@ -96,7 +96,7 @@ D3D.Slicer.prototype.slice = function (height, step) {
var min = Math.ceil(Math.min(line.line.start.y, line.line.end.y) / step);
var max = Math.floor(Math.max(line.line.start.y, line.line.end.y) / step);
- for (var layerIndex = min; layerIndex < max; layerIndex ++) {
+ for (var layerIndex = min; layerIndex <= max; layerIndex ++) {
if (layerIndex >= 0) {
if (layersIntersections[layerIndex] === undefined) {
layersIntersections[layerIndex] = [];