I've found a workaround to this. So when we use mods to increase items/currency, the related items/currency will be added to the storages. If storages are already full, the items will pile up inside the cave and cause a lag. We still can use the mods but we can't over exceed the max capacity of storages.
For example, the max capacity for my current items storage is 100. I'd keep the amount of every item as few as possible (around 2-5 per item) in the storage. When I want to upgrade the monsters with mod, I'll upgrade until the amount of cheese reaches around 80, then I'll turn off the mod and continue upgrading until the cheese reaches the lowest amount as possible. After upgrading, I'll turn off the mods and sell the rest of cheese, only keep only 2-5 cheese in the storage. The "sell/use" function can also be used to add items if we turn on the mods. This also works for money and ore, but this method is becoming a hassle after level 50, so it's best to add more storages as soon as possible to increase the capacity.