Query fixes

Whoa, much simplicity!