         collection = 'starred'
 
     counts = feedbin.Counts.get().counts[collection][group]
-    countWas = $(countContainer).text() * 1
+    countWas = countContainer.text() * 1
     count = 0
 
     if groupId

        count = counts[groupId].length
    else
      count = counts.length
    $(countContainer).text(count)

    if count == 0
      $(countContainer).addClass('hide')
    else
      $(countContainer).removeClass('hide')

    if groupId || countHide
      container = $(countContainer).parents('li').first()
      feedId = $(container).data('feed-id')
      if useHideQueue
        if count == 0 && countWas > 0


feedbin.applyCounts = (useHideQueue) ->
  $('[data-behavior~=needs_count]').each (index, countContainer) =>
    countContainer = $(countContainer)
    group = countContainer.data('count-group')
    groupId = countContainer.data('count-group-id')
    collection = countContainer.data('count-collection')
    countHide = countContainer.data('count-hide') == 'on'

    if !collection
      collection = 'unread'
