fixed error when no duplicates present