--max-duration and --retries not working correctly