Fixed Gui event handling, etc