use rw for random file access