Fix nodeValue check
Add logging