Try to avoid getting into infinite loops while sorting with rules.

This may well break something but as it was it would just keep trying, failing, resetting, repeat.