fix bug when removing link