Fix exception for non-string node attribute value #1039

also handle possible null value