Fix export_to_csv