Fix strange UI behaviour under some circumstances.