         
         if (predicateKey != nil) && (predicateOperator != nil) && (jsonPredicateValue != nil) {
             
-            // validate operator
-            
-            if predicateOperatorNumber == NSPredicateOperatorType.CustomSelectorPredicateOperatorType.rawValue {
+            // validate operator (cant be CustomSelectorPredicateOperatorType)
+            
+            if predicateOperator == NSPredicateOperatorType.CustomSelectorPredicateOperatorType {
                 
                 let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                 

                // to-many relationships
                else {
                    
                    let resourceIDs = jsonPredicateValue as? [UInt]
                    
                    // verify
                    
                    if resourceIDs == nil {
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                        
                        return (response, userInfo)
                    }
                    
                    let (fetchResult, error) = self.fetchEntity(relationshipDescription!.destinationEntity!, withResourceIDs: resourceIDs!, usingContext: context, shouldPrefetch: false)
                    
                    // error fetching
                    if error != nil {
                        
                        // tell delegate
                        self.delegate?.server(self, didEncounterInternalError: error!, forRequest: request, userInfo: userInfo)
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.InternalServerError, JSONResponse: nil)
                        
                        return (response, userInfo)
                    }
                    
                    // not found
                    if fetchResult!.count != jsonPredicateValue?.count {
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                        
                        return (response, userInfo)
                    }
                    
                    // set value
                    value = fetchResult
                }
            }
            

                // to-one
                if !relationshipDescription!.toMany {
                    
                    let resourceDictionary = jsonPredicateValue as? [String: UInt]
                    
                    // verify
                    if resourceDictionary == nil || resourceDictionary?.count != 1  {
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                        
                        return (response, userInfo)
                    }
                    
                    let resourceID = resourceDictionary!.values.first!
                    
                    let resourceEntityName = resourceDictionary!.keys.first!
                    
                    let resourceEntity = self.managedObjectModel.entitiesByName[resourceEntityName] as? NSEntityDescription
                    
                    // verify
                    if resourceEntity == nil || !(resourceEntity?.isKindOfEntity(relationshipDescription!.destinationEntity!) ?? true) {
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                        
                        return (response, userInfo)
                    }
                    
                    let (fetchedResource, error) = self.fetchEntity(resourceEntity!, withResourceID: resourceID, usingContext: context, shouldPrefetch: false)
                    
                    // error fetching
                    if error != nil {
