Tree automatically checks a new child

I am using a tree with threestatecheckbox enabled. When I add a new node where the parent was checked previously and saved, the newly added child is also checked. What is the fix to it?

tree = new dhtmlXTreeObject(“treeboxbox_tree”, “50%”, “50%”, 0);
tree.setImagePath(“/common/dhtmlxcomponents/dhtmlxTree/imgs/”);

tree.enableCheckBoxes(1);
tree.enableThreeStateCheckboxes(true);
tree.loadXML("x.do?submit=loadTree" , function() {
    tree.openAllItems(0);
});

tree.attachEvent("onCheck", treeHandler);
function treeHandler(id, state) {
    if (tree.getAllChecked() != '') {
        $("#checkedHierarchyId").val(tree.getAllChecked());
    } else {
        $("#checkedHierarchyId").val('');
    }
}

Hello
You use tree.enableThreeStateCheckboxes(true);
That is whi it is a correct behaviour.