to merge the same ranges nearby