minor error on permutation calculation