Don't match nodes if the tag name has changed. Added some debugging code to dump marks and DOMs.