fixed discard_duplicates