Fix read and write