check for duplicate elements