read and write data