Fixed linking and id saving