modified export to csv  helper