fix isSorted tests and solve typo problem with ex 4