Fixed csv export Closes #315