Fixing bug in greedyLeaves