fixed bug: can't use lower_bound() without sort()