Bug fix to check if parent element is atomic element.

Need to check if the node passed in is defined and not null.