fix bug in rw