Fixed bug in query generator.

If sub block was just text, it was not considered valid by the upper
block.