Fix database connection