add check for nodeType