Fix to database access