permute works with mode