Fixed problem with duplicates