swapUpToPerm was quite wrong.  Fixed.