Fixed AsSorted method