Add guard before accessing target.nodeName

We need to check that target exists before accessing its properties!
Merge pull request #471 from starwed/control-addGuard

Add guard before accessing target.nodeName