IE & relatedTarget again

PR #401 was not complete. My intention was to set the relatedTarget
to null if we run into one of these invalid relatedTargets.
Merge pull request #404 from arv/related-target-work-around

IE & relatedTarget again