Fixing isAncestorOf (should always return boolean value)