check if name already unsed

we only care that the name has a position, not what is is, so don't waste resources looking it up
need to account for null values

isset will return false if value is null which is not what we want. `array_key_exists` will still be faster than `array_search`
Merge branch 'hotfix/6541'

Close #6541