added check for child nodes