fixing retry logic