Been trying to work through this issue myself. Seems to happen when FC calls Game.CalculateGains on line 2156. For some reason in the vanilla game code starting on line 5078, a number gets assigned to me.amount when it iterates through the upgrade objects and then it'll calculate a new cookiePs value based on me.amount and storedCps value. Might have something to do with your upgradetoggle, upgradestats or reverse function (not sure which).
Been trying to work through this issue myself. Seems to happen when FC calls Game.CalculateGains on line 2156. For some reason in the vanilla game code starting on line 5078, a number gets assigned to me.amount when it iterates through the upgrade objects and then it'll calculate a new cookiePs value based on me.amount and storedCps value. Might have something to do with your upgradetoggle, upgradestats or reverse function (not sure which).