correct read and write