More DB connection fixes