fixed crash when reopening while running.