Implement retries, and fix failing tests.