     }
     
     if let method = WebService.ChallengeMethod(method: authenticationMethod) where method == .Default || method == .HTTPBasic {
-      if let maxAuth = webService?.maxAuthRetry where maxAuth == 0 || authCount++ < maxAuth {
+      if let maxAuth = webService?.maxAuthRetry where maxAuth == 0 || authCount < maxAuth {
+        authCount += 1
         taskResult = authenticationHandler(WebService.ChallengeMethod(method: authenticationMethod)!, completionHandler)
       } else {
         completionHandler(.PerformDefaultHandling, nil)

      taskResult = WebTaskResult.Failure(error)
    }
    handlerQueue.suspended = false
    if let urlTask = urlTask {
      webService?.webDelegate?.tasks.removeValueForKey(urlTask.taskIdentifier)
    }

    urlTask?.resume()
    
    if let semaphore = semaphore {
      let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeout * Int(NSEC_PER_SEC)))
      dispatch_semaphore_wait(semaphore, time)
      if urlTask?.state == .Running {
        urlTask?.cancel()
