Fix handling of empty result sets for CSV export