Fixed pathLength call in allPermutations