Fixed bug that checked number of possible permutations