Fixed, thanks mate!
Regarding the freezing/crashing, is this a longterm-ish save or one that you've fought a lot in? The only thing I could think of that would slow anything down would be if the NPC pool has grown too large and bloated the save file size. If you go into expansionsettings.gd and change minimum_npcs_to_detain to a lower number like 5-10 and up the townguardefficiency, it should reduce the pool on the next End of Day. See if that fixes the freezing issue