Fixing bugs related to castle defenses