Changed declaration of isSorted.