fix permute