isSorted bug not fixed on this branch