Fixed some problems with the database connections.