If you use 40 unit x save , you must remember for some unknown reason if you put more than 20 unit in the caste and the ai siege you , even if you win your unit will vanish deleted by ai only general and 1-3 unit get spared,also if you select all unit (more than 20 unit) from inside the castle, the game will crash for unknown reason, fortunately there are some trick to prevent this, first never put the main army into building let them behind castle, so when got besieged by enemy your main army can come as reinforcement , when you win battle the ai will not deleted unit outside the castle.Also never select all the unit inside castle (more than 20 unit i talk this) .I know its not convenient to select one by one outside castle, well i dont know other solution.
The maximum unit allowed inside the castle must not more than 20 unit (garrison unit + real unit) or you can suffer the bug. Or you can put 20 unit in castle but remember as long the ai dont siege you its ok, if not be prepare to see your unit gone smoke after the battle, either you win or lose