     
     //the background task failed.
     func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didCompleteWithError error: NSError!) {
-        if error {
+        if error != nil {
             if self.backgroundFailure != nil { //Swift bug. Can't use && with block (radar: 17469794)
                 self.backgroundFailure!(error)
                 self.backgroundFailure = nil

            var split = url.hasPrefix("/") ? "" : "/"
            urlVal = "\(self.baseURL!)\(split)\(url)"
        }
        if !self.requestSerializer {
            self.requestSerializer = HTTPRequestSerializer()
        }
        return self.requestSerializer.createRequest(NSURL.URLWithString(urlVal),

        let session = NSURLSession.sharedSession()
        let task = session.dataTaskWithRequest(serialReq.request,
            completionHandler: {(data: NSData!, response: NSURLResponse!, error: NSError!) -> Void in
                if error != nil {
                    failure(error)
                    return
                }
                if data != nil {
                    var responseObject: AnyObject = data
                    if self.responseSerializer != nil {
                        let resObj = self.responseSerializer!.responseObjectFromResponse(response, data: data)
