arrayToCsv func and format fix