Fixed bug where queryState=false caused error.

In particular when queryState=false then we get an uncaught TypeError:
boolean is not a function.