Fixing database connection