Fixed database connection issues