Fix CSV and PostgreSQL storage conversion