fix bufferwriter