fix error in retry logic