fix output to csv