aggregate query bugfix