Fixing output to csv