Fixing up database connection