fixed _is_sorted