Csv template fix

Hello, here is a more reliable way to generate csv files.