changes and fixes to database creation