fix write buffer process