When i import feeds into an entity reference field, it creates duplicate values that look like the code below (using devel module)
$field_tags_people['und'][0]['target_id'] = 578
$field_tags_people['und'][1]['target_id'] = 578
$field_tags_people['und'][2]['target_id'] = 594
each of the target_id should have different values but turns out some are duplicates. I have tried this code
$field_tags_people['und'] = array_unique($field_tags_people['und'])
but it removes all terms except the first one. This seems strange due to the target_id key. How can I make this work?