I have an idea for what is happening. But not why it's happening
The reference to the calculate button is invalid, but I don't know why it would be.
The library could think the UI definition changed, so it's wiping it and rebuilding it, but then it should also update the references in global.
If I were to just check its validity, I'm sure I'll have problems with it elsewhere as most of my code assumes the references are valid since they should be static.
Could you send me the save that has the problem? I might be able to recreate it myself, but, like I said, I'm too tapped out.
For now, disabling the mod, saving without it, and then loading it with the mod should work as a workaround.