Fix a bug at QueryGenerator.