Fix database connection issues