fixed to output data in proper CSV format