read/write fixes