         console.log('no valid previous current note found. create new note')
         noteManager.make_new_note().then(
           (note) =>
-            vm.change_current_note(guid=note.guid, title=note.title, md=note.md)
+            vm.change_current_note(note.guid, note.title, note.md)
             console.log('New note made: ' + JSON.stringify(note))
           (error) =>
-            alert('make_new_note() failed!')
-        ).catch (error) => alert('make new note failed!')
-    p.catch (error) => alert('load previous current note failed')
+            alert('make_new_note() failed: ' + error)
+        ).catch (error) =>
+          trace = printStackTrace({e: error})
+          alert('Error, make new note failed!\n' + 'Message: ' + error.message + '\nStack trace:\n' + trace.join('\n'))
+    p.catch (error) => alert('load previous current note failed: ' + error)
 
     # get note list
     vm.refresh_all_notes()

    # set markdown (single direction updating)
    vm.set_md(vm.ace_editor.getValue())
    # TODO optimize performance
    vm.render_html($('#md_html_div'))

  # ------------------------------------------------------------------------------------------------------------------
  # markdown render functions
  # ------------------------------------------------------------------------------------------------------------------
  vm.render_html = (jq_html_div) ->
    processed_md = vm.md_pre_process(vm.get_md())
    _html_dom = $('<div></div>')
    _html_dom.html($window.marked(processed_md, {sanitize: true}))
    return vm.html_post_process(_html_dom).then () ->
      jq_html_div.empty()
      jq_html_div.append(_html_dom)

  vm.md_pre_process = (md) ->
    # TODO more handling
    processed_md = md
    return processed_md

  # return promise
  vm.html_post_process = (jq_tmp_div) ->
    # code highlighting
    jq_tmp_div.find('pre code').each (i, block) ->
      hljs.highlightBlock(block)
    # render Latex
    MathJax.Hub.Queue(['Typeset', MathJax.Hub, jq_tmp_div.get(0)])
    # change img src to real data url
    must_finish_promise_list = []
    jq_tmp_div.find('img[src]').each (index) ->
      $img = $(this)
      uuid = $img.attr('src')
      p = imageManager.find_image_by_uuid(uuid).then(
        (image) =>
          if image?
            console.log('change img src from ' + uuid + ' to its base64 content')
            $img.attr('longdesc', uuid)
            $img.attr('src', image.content)
        (error) =>
          alert('vm.html_post_process() failed due to failure in imageManager.find_image_by_uuid(' + uuid + ')')
      )
      must_finish_promise_list.push(p)
    return Promise.all(must_finish_promise_list).then () -> return jq_tmp_div

  # ------------------------------------------------------------------------------------------------------------------
  # Operations for notes

          note.status == noteManager.NOTE_STATUS.MODIFIED)
            # note in db -> current note
            console.log('loading note ' + note.guid + ' with status ' + note.status + ' from local DB')
            vm.change_current_note(note.guid, note.title, note.md)
            vm.close_loading_modal()
            console.log('loading note ' + note.guid + ' finished')
        if (note? == false) or (note.status == noteManager.NOTE_STATUS.SYNCED_META)
