Fix some bugs with the way Gui's work.
Merge pull request #485 from alexbegt/master

Fix some bugs with the way Gui's work.