Fixed output to csv issue.