             var stringValue = (object as! String)
             
             // linear-gradient(color1, color2)
-            let match = linearGradRegExpr.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count))
+            let match = NSDictionary.linearGradRegExpr?.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count))
             if match?.numberOfRanges == 11 {
                 // Starting color
                 let red1 = Float(stringValue.substring(withNSRange: match!.rangeAt(2)))! / 255

            // pattern
            if (object is String) {
                var stringValue = (object as! String)
                let match = patternRegExpr.firstMatch(in: stringValue, options:NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count))
                if match?.numberOfRanges == 6 {
                    let isNamedType = stringValue.substring(withNSRange: match!.rangeAt(2)) == "named"
                    let imageName = stringValue.substring(withNSRange: match!.rangeAt(3))

            
            // Resolve any variables
            var rangeOffset = 0
            NSDictionary.varsRegExpr?.enumerateMatches(in: stringValue, options: NSRegularExpression.MatchingOptions(rawValue: UInt(0)), range: NSMakeRange(0, stringValue.characters.count), using: { (match, flags, stop) in
                var range = match?.rangeAt(1)
                range?.location += rangeOffset
                
