fix a bug in retry