fixed binary reads and writes