csv to DB script fixes