make Permutation's next function not modify its second argument (s), to fix compability with filter, see issue #4381
added tests to check fix of #4381
Merge pull request #4382 from astrieanna/fixpermutations

Fix Permutation's `next` function to work with Filter