Add export to CSV option

Bug fix