fix maxAttempts === null means unlimited attempts