add some retry and stat logic