Fix for memory leak related to Lua-spawned NPCs.