sortFirst(): only change the return value once, not at every iteration