Fixed bug with adding duplicates