added check permutation