added isLeavingRoot()