Allow null query comparands

I haven't tested this everywhere, so there might be other places (especially for in-memory queries) that need to be changed as well.

However, this change is enough to make my code work.