fix retry logic