Fix a check if the current attempt reached the maximum