fix write \n bug