Fix implicit conversion bug.

See the discussion for details:

https://github.com/mavam/vast/commit/dd02f67d35431df9870b2832ffb00ab8a3382b6c#commitcomment-6832252
Allow for disabling of catch-all handler.
Add bit-fiddling unit tests as part of a bug hunt.
Fix bugs in query FSM.