Fixed error relating to csv file generation.