Handle NULL node ref. in node_matches