More thorough test for goBackFirstOnSort and make the check dynamic