fixed permutation checker