Fix permutations

fixes #1