Fixing errors when the database is not the default database for tests