Extra check added to findAncestor