fixed permutation crashes