add deal with duplicated elements