Fix retry logic