Fixed a problem with duplicates