Fix bug with csvwriter