Some tweaks to retry logic.