Fixed reading and writing.