Fix shutdown/restart issue.