fix read write problem