         if userKeyboardExists(withID: kbID, languageID: langID) {
           newKb = currentKb
           if let kbName = currentKb[kKeymanKeyboardNameKey]?.replacingOccurrences(of: "\\'", with: "\'") {
-            newKb![kKeymanKeyboardNameKey] = kbName
+            newKb[kKeymanKeyboardNameKey] = kbName
           }
           if let langName = currentKb[kKeymanLanguageNameKey]?.replacingOccurrences(of: "\\'", with: "\'") {
-            newKb![kKeymanLanguageNameKey] = langName
+            newKb[kKeymanLanguageNameKey] = langName
           }
         }
       } else if let userKbs = activeUserDefaults().array(forKey: kKeymanUserKeyboardsListKey) as? [[String: String]],
         !userKbs.isEmpty {
         newKb = userKbs[0]
       }
-      if let newKb = newKb {
-        setKeyboard(newKb)
-      }
+      setKeyboard(newKb)
     }
 
     let kbInfo = [kKeymanKeyboardIdKey: keyboardID, kKeymanLanguageIdKey: languageID]

    let userKeyboards = activeUserDefaults().array(forKey: kKeymanUserKeyboardsListKey)
    let index = indexForUserKeyboard(withID: keyboardID, languageID: languageID)

    let kbDict: [String: String]
    if let index = index {
      kbDict = userKeyboards![index] as! [String: String]
    } else {
      kbDict = keyboardsDictionary[key]!
    }

    var langName = kbDict[kKeymanLanguageNameKey]
    var kbName = kbDict[kKeymanKeyboardNameKey]
    let kbVersion = latestKeyboardFileVersion(withID: keyboardID) ?? "1.0"
    let isRTL = kbDict[kKeymanKeyboardRTLKey]

    if key == "\(kKeymanDefaultLanguageID)_\(kKeymanDefaultKeyboardID)" {
      if langName == nil || kbName == nil {

    let userKeyboards = activeUserDefaults().array(forKey: kKeymanUserKeyboardsListKey)
    let index = indexForUserKeyboard(withID: keyboardID, languageID: languageID)

    let kbDict: [String: String]?
    if let index = index {
      kbDict = userKeyboards![index] as? [String: String]
    } else {
      kbDict = keyboardsDictionary[key]
    }

    let kbVersion = latestKeyboardFileVersion(withID: keyboardID) ?? "1.0"
    let isRTL = kbDict?[kKeymanKeyboardRTLKey]

    var jsFont = jsFontString(font)
    var jsOskFont: String
