         when '/kcsapi/api_port/port', '/kcsapi/api_get_member/deck', '/kcsapi/api_req_hensei/change'
           {_decks, _ships} = window
           ship = _decks[0]?.api_ship[0]
-          if ship and ship > 0
+          if ship? and ship > 0
             secretary = _ships[ship].api_ship_id
             @setState
               fleetSecretary: secretary
             if @state.notifySecretary == 0
               @updateNotifyConfig(secretary)
 
-    ###*
-     * Update notification config using audio of ship
-     * @param {number} ship id in window.$ships or default audio if equals -1
-     ###
     updateNotifyConfig: (ship_id) ->
-      if ship_id == -1
-        for s in ['construction','repair','expedition','morale']
-          config.set("poi.notify.#{s}.audio")
-      if ship_id > 0
-        server = SERVERS[(ship_id + SERVER_NONCE) % SERVERS.length]
-        filename = @state.shipgraph[ship_id]?.api_filename
-        return unless server
-        return unless filename
-        audio_constr = "http://#{server}/kcs/sound/kc#{filename}/5.mp3"
-        audio_expedi = "http://#{server}/kcs/sound/kc#{filename}/7.mp3"
-        audio_repair = "http://#{server}/kcs/sound/kc#{filename}/6.mp3"
-        audio_morale = "http://#{server}/kcs/sound/kc#{filename}/27.mp3"
-        config.set('poi.notify.construction.audio', audio_constr)
-        config.set('poi.notify.expedition.audio', audio_expedi)
-        config.set('poi.notify.repair.audio', audio_repair)
-        config.set('poi.notify.morale.audio', audio_morale)
+      return unless ship_id > 0
+      server = SERVERS[(ship_id + SERVER_NONCE) % SERVERS.length]
+      filename = @state.shipgraph[ship_id]?.api_filename
+      return unless server
+      return unless filename
+      audio_constr = "http://#{server}/kcs/sound/kc#{filename}/5.mp3"
+      audio_expedi = "http://#{server}/kcs/sound/kc#{filename}/7.mp3"
+      audio_repair = "http://#{server}/kcs/sound/kc#{filename}/6.mp3"
+      audio_morale = "http://#{server}/kcs/sound/kc#{filename}/27.mp3"
+      config.set('poi.notify.construction.audio', audio_constr)
+      config.set('poi.notify.expedition.audio', audio_expedi)
+      config.set('poi.notify.repair.audio', audio_repair)
+      config.set('poi.notify.morale.audio', audio_morale)
 
     handleShipChange: (e) ->
       ship_id = parseInt(e.target.value)
       return if ship_id is NaN
       # Save secretary config
+      config.set('plugin.secretary.ship', ship_id)
       @setState
         notifySecretary: ship_id
-      config.set('plugin.secretary.ship', ship_id)
       # Update notify config
       if ship_id == 0
         @updateNotifyConfig(@state.fleetSecretary)

          {
            if @state.isLogin
              options = []
              options.push(
                <option key={-1} value={-1}>
                  {__ 'Default poi: Reset to default audio poi'}
                </option>
              )
              options.push(
                <option key={0} value={0}>
                  {__ 'Current secretary'}: { if @state.fleetSecretary && window.$ships[@state.fleetSecretary]? then window.i18n.resources.__ window.$ships[@state.fleetSecretary].api_name else __ 'Unknown' }
                </option>
              )
              for ship, i in @state.ships

    handleAudition: (type) ->
      switch type
        when 'construction'
          notify null,
            type: 'construction'
        when 'expedition'
          notify null,
            type: 'expedition'
        when 'repair'
          notify null,
            type: 'repair'
        when 'morale'
          notify null,
            type: 'morale'

    handleDisable: ->
      for s in ['construction', 'repair', 'expedition', 'morale']
        config.set("poi.notify.#{s}.audio")
      @setState
        notifySecretary: -1

    render: ->
      <div>
