I have some tweaks which should fix it on your side, but it won't help any mods that don't rebuild their GUI every on_configuration_changed:
1) changed destroy_gui to destroy_main_gui on many lines
2) changed the name on line 32 to name="TTS_main"..index,
3)Changed the last function to:
function destroy_main_gui(screen)
for num,elm in pairs(screen.children) do
if string.find(elm.name, "TTS_main") then
elm.destroy()
end
end
end