Updated client write_chunk