Fix isSorted