fixed problems with database connections