I added this code which seems to solve the problem. Not really happy with it, but at least it seems to work now.
Lua Code:
SaveSettings() -- save and restore the settings when we leave an area through a loading screen, otherwise they may get messed up
RegisterForEvent(EVENT_PLAYER_ACTIVATED, function()
if(not GetGuiHidden(INGAME_GUI_NAME)) then
ApplyCustomSettings(savedSettings)
else
ApplyCustomSettings(DESIRED_SETTINGS)
end
end)
RegisterForEvent(EVENT_PLAYER_DEACTIVATED, function()
if(not GetGuiHidden(INGAME_GUI_NAME)) then
SaveSettings()
end
end)