Bugfix -  Adds checks for invalid node element

fixes #3