Handle the case when parentNode is null.
Merge pull request #1136 from lbeder/master

Handle the case when parentNode is null