Fix on_exit in app