modified read_block and write_block