optimize between hasChildren and getChildrenCount