Fix _write() code to avoid copying input buffer.