Index: DiskFile.java
===================================================================
--- DiskFile.java	(revision 1665)
+++ DiskFile.java	(working copy)
@@ -209,16 +209,13 @@
                 DataOutputStream out = new DataOutputStream(buff);
                 final int blocks = (int) ((file.length() - OFFSET) / BLOCK_SIZE);
                 out.writeInt(blocks);
-                for (int i = 0, x = 0; i < blocks / 8; i++) {
-                    int mask = 0;
-                    for (int j = 0; j < 8; j++) {
-                        if (used.get(x)) {
-                            mask |= 1 << j;
-                        }
-                        x++;
-                    }
-                    out.write(mask);
+                int end = blocks/8;
+                byte[] tempBuff = new byte[end];
+                for (int i = 0; i < end; i++) {
+                    tempBuff[i] = (byte) (used.getByte(i << 3) & 255);
                 }
+                out.write(tempBuff, 0, tempBuff.length);
+                tempBuff = null;
                 out.writeInt(pageOwners.size());
                 ObjectArray<Storage> storages = ObjectArray.newInstance();
                 for (int i = 0; i < pageOwners.size(); i++) {
@@ -300,16 +297,21 @@
                     return;
                 }
                 stage++;
+                byte[] temp = new byte[b2];
+                int bytesRead = in.read(temp);
+                if (bytesRead != b2) {
+                    //TODO Pick error message for unable to read enough!
+                }
                 if (init) {
                     for (int x = 0; x < b2; x += 8) {
-                        int mask = in.read();
+                        int mask = temp[x];
                         if (mask != used.getByte(x)) {
                             Message.throwInternalError("Redo failure, block: " + x + " expected: " + used.getByte(x) + " got: " + mask);
                         }
                     }
                 } else {
                     for (int x = 0; x < b2; x += 8) {
-                        int mask = in.read();
+                        int mask = temp[x];
                         used.setByte(x, mask);
                     }
                 }
