[FIX/TEST] Fix problem with sorting adding stopifnot tests to example code.