fix potential type instability in `next` for `Permutations`