expm: fix two permutation bugs, due to @acroy [closes #5116]