IOS onExit bug fixes