Fix RestartApp bugs.