reverted to old duplicate checking code as the new one does allow
duplicates for some arrays. The old code contains the fix for issue
#228.