You're not doing anything wrong. You need to manually re-do the links.
That is why using an init trigger where one can set the abilities, unit types etc. is recommendedd, sadly many don't add that for their spells, and one has to go through the code to change all necessary things.