Fix bug in core Query()
Fix bug in core Query()