fixed firing of onLeave method in MainMenuState