Fixing write_block()