Some more refresh fixes...

Should fix #1140 (1063ee7) & both ghosting issues reported in #1119 (eef26a0)

Bundles an unrelated logic fix (3d5dd44)

And a new possible cause of issues :D. (1ee0901)
Why do you write to UIManager's "local" variables here? Honestly I don't like it, it's quite intransparent when looking at uimanager.lua. Better add a function-based interface to uimanager and call that.