Changes to better handle local database creation

also make sure the database gets created