Corrected to binary mode file read/write.