Fixes parent checkbox is checked when no children

In case childrens are dynamically created, parent checkbox is checked when there is no children, this PR fixes that.