Fixed database connection