Fix retry behaviour

- retryCount wasn't being incremented, so maxRetries was never being reached
- Keep the optimal delay value in config