Fix permute function.
Hopefully fix CI script.