query bugfix