       result[tag]=true for tag in doc.tags
     Object.keys(result)
     lods = [] # list of dicts
-    active_tags = Session.get("active_tags")
+    my_active_tags = active_tags.get()
     for tag_name in Object.keys(result)
       tmp = {name:tag_name}
-      if tag_name of active_tags
+      if tag_name of my_active_tags
         tmp.is_active_css_class='active'
       else
         tmp.is_active_css_class=''

Template.Search.events
  "click .tag-name": (event, template) ->
    event.preventDefault()
    obj = Session.get("active_tags")
    myname = this.name
    if myname of obj
      delete obj[myname]
    else
      # add item
      obj[myname] = true
    Session.set("active_tags",obj)
    update_url_bar()

del = (obj, key) ->

  if !@find("#comments-search-input")?
    return
  if @data.text?
    comments_search_text.set(@data.text)
  if @data.idid?
    flycircuit_search_text.set(@data.idid)
  if @data.tags?
    atl = JSON.parse(@data.tags)
    taglist = {}
    for tag in atl
      taglist[tag] = true
    active_tags.set(taglist)
  this.find("#comments-search-input").value = comments_search_text.get()
  this.find("#flycircuit-search-input").value = flycircuit_search_text.get()

Template.Search.helpers
  current_search: ->
