Simplified reading contents of the file into the buffer. Fixes checksum mismatch.