Minor improvements for DB connection