added an other null check for canAddChildNode()