         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')

      for n in notes
        if (n.guid not in remote_note_guid_list) && n.status != @NOTE_STATUS.NEW && n.status != @NOTE_STATUS.MODIFIED
          @delete_note(n.guid)
          console.log('local note ' + n.guid + ' deleted.')

  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| DB Operations >

  get_all_notes: () =>
    return @db_server.notes.query().all().execute()

  delete_note: (guid) =>
    @find_note_by_guid(guid).then (notes) =>
      for note in notes
        do (note) =>
          @db_server.notes.remove(note.id)

  # fixme for debug
  add_fake_note: () =>

  # return: promise containing note's info
  # ------------------------------------------------------------
  fetch_remote_note: (guid) =>
    console.log('fetch_remote_note(' + guid + ') begins to invoke')
    return @find_note_by_guid(guid).then (note) =>
      console.log('fetch_remote_note(' + guid + ') local note: ' + JSON.stringify(note))
      if note != null && note.status == @NOTE_STATUS.SYNCED_ALL
        console.log('Local note fetch hit: ' + JSON.stringify(note))
        return note
      else
        console.log('Local note fetch missed, fetch from remote: ' + guid)
        return apiClient.notes.note({id: guid}).$promise.then (data) =>
          _note =
            guid: guid
            title: data.note.title
            md: data.note.md
            status: @NOTE_STATUS.SYNCED_ALL
            resources: data.note.resources
          @update_note(_note)
          return _note

  # ------------------------------------------------------------
  # Load remote note list to update local notes info
