Fix enter/leave behavior in gui