fixed error in deleteDuplicates