       addEventListener "message", Api.listener.bind(Api), false
       ledger.i18n.init =>
         ledger.preferences.defaults.init =>
-          @setExecutionMode(@Modes.Wallet)
-          @router.go('/')
+          @router.go('/') if @setExecutionMode(@Modes.Wallet)
 
     ###
       Sets the execution mode of the application. In Wallet mode, the application handles the wallets state by starting services,

    ###
    setExecutionMode: (newMode) ->
      throw "Unknown execution mode: #{newMode}. Available modes are ledger.app.Wallet or ledger.app.FirmwareUpdate." if _(_.values(@Modes)).find((m) -> m is newMode).length is 0
      return if newMode is @_currentMode
      @_currentMode = newMode
      if @isInFirmwareUpdateMode()
        @_releaseWallet(no)
        ledger.utils.Logger.setGlobalLoggersPersistentLogsEnabled(off)
        ledger.utils.Logger.setGlobalLoggersLevel(ledger.utils.Logger.Levels.NONE)
      else
        ledger.utils.Logger.setGlobalLoggersPersistentLogsEnabled(on)
        ledger.utils.Logger.updateGlobalLoggersLevel()
        @connectDongle(ledger.app.dongle) if ledger.app.dongle?
      return

    ###
      Checks if the application is in wallet mode.

      @_releaseWallet()

    onCommandFirmwareUpdate: ->
      @router.go '/' if @setExecutionMode(ledger.app.Modes.FirmwareUpdate)


    onCommandExportLogs: ->
      ledger.utils.Logger.downloadLogsWithLink()
