Fix restart logic