fixed read and write