Added node type check to fix error.