Fix read/write issues