better error handling in db initialization