fixed problems with database connection