Fixed CSV code

I think this should fix the CSV problems we've been having.