fix bug with multiple read/writes