diff --git a/src/edu/caltech/cs2/lab02/Image.java b/src/edu/caltech/cs2/lab02/Image.java
index 8301f43fab8f98b32f7dfcbf2f423bc2ea231613..ca40a5e2a9fe16a4c2b5ab0cbd95114a525fb6f5 100644
--- a/src/edu/caltech/cs2/lab02/Image.java
+++ b/src/edu/caltech/cs2/lab02/Image.java
@@ -69,9 +69,12 @@ public class Image {
         int ctr = 0;
         for (char c : text.toCharArray()) { // https://stackoverflow.com/a/2451660
             for (int j=0; j<8; j++) {
+//                bits_to_write[ctr] = (c >> (7-j)) & 1;
+                if (ctr >= height*width) break;
                 bits_to_write[ctr] = (c >> j) & 1;
                 ctr ++;
             }
+            if (ctr >= height*width) break;
         }
 
         Pixel[][] new_pix = new Pixel[height][width];
@@ -79,8 +82,9 @@ public class Image {
         ctr = 0;
         for (int i=0; i<height; i++) {
             for (int j=0; j<width; j++) {
-                new_pix[i][j] = this.pixels[i][j];
-                new_pix[i][j].fixLowestBitOfR(bits_to_write[ctr]);
+//                new_pix[i][j] = this.pixels[i][j];
+//                new_pix[i][j].fixLowestBitOfR(bits_to_write[ctr]);
+                new_pix[i][j] = this.pixels[i][j].fixLowestBitOfR(bits_to_write[ctr]);
                 ctr ++;
             }
         }