fixed bug on rw.py