fixed a bug in QueryOptimizers.