some general improvements regarding database connections