Permutation problem solved