Fixed bug in querygenerator.

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