fix query check

/cc @dantleech