Copy arrays in unorderedEqual before sorting

It turns out that the array.sort() method sorts the arrays in place.
This commit prevents arrays passed to the unorderedEqual method from
being altered.