Fix pass-by-reference bug when restarting an app.