     # Visually highlight of the active hint (that is, the one that will be activated if the user
     # types <Enter>).
     tabCount = ((linksMatched.length * Math.abs tabCount) + tabCount) % linksMatched.length
-    @activeHintMarker?.classList?.remove "vimiumActiveHintMarker"
+
+    if @activeHintMarker
+      @activeHintMarker.classList.remove "vimiumActiveHintMarker"
     @activeHintMarker = linksMatched[tabCount]
-    @activeHintMarker?.classList?.add "vimiumActiveHintMarker"
-    @activeHintMarker?.style?.zIndex = getNextZIndex()
+    if @activeHintMarker
+      @activeHintMarker.classList.add "vimiumActiveHintMarker"
+      @activeHintMarker.style.zIndex = getNextZIndex()
 
     linksMatched: linksMatched
-    userMightOverType: @hintKeystrokeQueue.length == 0 and 0 < @linkTextKeystrokeQueue.length
+    userMightOverType: @hintKeystrokeQueue.length == 0 and @linkTextKeystrokeQueue.length > 0
 
   pushKeyChar: (keyChar) ->
-    if 0 <= @linkHintNumbers.indexOf keyChar
+    if @linkHintNumbers.indexOf(keyChar) >= 0
       @hintKeystrokeQueue.push keyChar
     else if keyChar.toLowerCase() != keyChar and @linkHintNumbers.toLowerCase() != @linkHintNumbers.toUpperCase()
       # The the keyChar is upper case and the link hint "numbers" contain characters (e.g. [a-zA-Z]).  We don't want

# Suppress all keyboard events until the user stops typing for sufficiently long.
class TypingProtector extends Mode
  constructor: (delay, callback) ->
    @timer = Utils.setTimeout delay, => @exit()

    resetExitTimer = (event) =>
      clearTimeout @timer
      @timer = Utils.setTimeout delay, => @exit()

    super
      name: "hint/typing-protector"
      suppressAllKeyboardEvents: true
      keydown: resetExitTimer
      keypress: resetExitTimer

    @onExit ->
      callback true # true -> isSuccess.

      # If link hints is launched within the help dialog, then we only offer hints from that frame.  This
      # improves the usability of the help dialog on the options page (particularly for selecting command
      # names).
      if isVimiumHelpDialog and not window.isVimiumHelpDialog
        @localHints = []
      else
        @localHints = LocalHints.getLocalHints requireHref
      @localHintDescriptors = @localHints.map ({linkText}, localIndex) -> {frameId, localIndex, linkText}
      @sendMessage "postHintDescriptors", hintDescriptors: @localHintDescriptors
      return
    return

  # We activate LinkHintsMode() in every frame and provide every frame with exactly the same hint descriptors.
  # We also propagate the key state between frames.  Therefore, the hint-selection process proceeds in lock
