Fix to include global query