fix handleLinkAdded logic