reverseGreedyNaive fix