handle auto-restart