Fix bug with csv generation