         title = note_meta['title']
         console.log('Merging note [' + guid + ']')
 
-        @find_note_by_guid(guid).then (local_note) =>
-          if local_note.length == 0
+        @find_note_by_guid(guid).then (note) =>
+          if note == null
             console.log('About to add note ' + guid)
             @add_note_meta({
               guid: guid
               title: title
             })
           else
+            console.log('local note ' + guid + ' exists, updating from remote.')
             switch local_note.status
               when @NOTE_STATUS.NEW
                 console.log('[IMPOSSIBLE] remote note\'s local cache is in status NEW')

                })
              when @NOTE_STATUS.SYNCED_ALL
                # fetch the whole note from server and update local
                @fetch_remote_note(guid).then (data) =>
                  note =
                    guid: data.note.guid
                    title: data.note.title
                    md: data.note.md
                  @update_note(note)
                  # TODO @update_image_manager
              when @NOTE_STATUS.MODIFIED
                # do nothing
                console.log('do nothing')

          # close modal
          vm.close_loading_modal()
        (error) ->
          alert('load note ' + guid + ' failed: ' + JSON.stringify(error))
          vm.close_loading_modal()
      )

