fix greedy algorithm. forgot to add v.