fix greedy mode