Fixed crash when restarting app.