Added node type check for error fix.