Fix link removal logic