finally got read/write working