Reduce / fix (?) memory leak connected with Scripting API recreation

[#60338690]