fix bufwrite command