move isLeaf check into ascend