Arkane,

Could by any chance the 14 'bad' $cn's contain the character , (comma)

Then You should try to include the code:

$cn = Join(Split($cn,','),'\,')

At the start of your function

-Erik