more general improvements regarding database connections