add safeguards when restarting