Fix lazy database connection