     let userKeyboards = activeUserDefaults().array(forKey: kKeymanUserKeyboardsListKey)
     let index = indexForUserKeyboard(withID: keyboardID, languageID: languageID)
 
-    let kbDict: [String: String]
+    let kbDict: [String: String]?
     if let index = index {
-      kbDict = userKeyboards![index] as! [String: String]
+      kbDict = userKeyboards![index] as? [String: String]
     } else {
-      kbDict = keyboardsDictionary[key]!
+      kbDict = keyboardsDictionary[key]
     }
 
     let kbVersion = latestKeyboardFileVersion(withID: keyboardID) ?? "1.0"
-    let isRTL = kbDict[kKeymanKeyboardRTLKey]
+    let isRTL = kbDict?[kKeymanKeyboardRTLKey]
 
     var jsFont = jsFontString(font)
     var jsOskFont: String

    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 = self.jsFont(forKeyboardID: keyboardID, languageID: languageID)
    var jsOskFont = self.jsOskFont(forKeyboardID: keyboardID, languageID: languageID)
