Fix recursion loop when an element contains a non-existant target.