fix write csv