                     rightAnchor: "rightSpacer",
                     vertical: false,
                     width: nil)
+                let keyGap = layout["keyGap"]!
                 addGapsInRange(
                     "keyGap%dx%d",
                     row: i,
                     startIndex: 1,
                     endIndex: rowsCount - 1,
                     vertical: false,
-                    width: layout["keyGap"]!)
+                    width: "\(keyGap)")
             }
         }
     }

                    leftAnchor: "leftSpacer",
                    rightAnchor: "rightSpacer",
                    vertical: false,
                    width: 0)
                addGapPair(
                    "keyGap%dx%d",
                    row: i,

            constant: 0))
    }
    
    func addGapPair(nameFormat: String, row: Int, startIndex: Int, endIndex: Int, leftAnchor: String?, rightAnchor: String?, vertical: Bool, width: String?) {
        var allConstraints: Array<String> = []
        
        var leftGapName = String(format: nameFormat, startIndex, row)
        var rightGapName = String(format: nameFormat, endIndex, row)
        
        var verticalFlag = (vertical ? "V:" : "")
        var inverseVerticalFlag = (!vertical ? "V:" : "")
        
        // anchoring
        
        if leftAnchor {
            allConstraints += "\(verticalFlag)[\(leftAnchor!)][\(leftGapName)]"
        }
