       itemNode = document.createElement('listitem')
       itemNode.setAttribute('value', style.styleID)
       itemNode.setAttribute('label', style.title)
-      listbox.appendChild(itemNode)
+      stylebox.appendChild(itemNode)
     if style.styleID is selectedStyle then selectedIndex = i
   if selectedIndex is -1 then selectedIndex = 0
   @styleChanged(selectedIndex)
 
   window.setTimeout((->
-    listbox.ensureIndexIsVisible(selectedIndex)
-    listbox.selectedIndex = selectedIndex
+    stylebox.ensureIndexIsVisible(selectedIndex)
+    stylebox.selectedIndex = selectedIndex
     return), 0)
   return


  styles = (style for style in Zotero.Styles.getVisible() when style.usesAbbreviation)

  listbox = document.getElementById('better-bibtex-abbrev-style')
  fillList = listbox.children.length is 0
  selectedStyle = Zotero.BetterBibTeX.pref.get('auto-abbrev.style')
  selectedIndex = -1
  for style, i in styles

  return "http://localhost:#{serverPort}/better-bibtex/#{url}"

Zotero.BetterBibTeX.pref.styleChanged = (index) ->
  stylebox = document.getElementById('better-bibtex-abbrev-style')
  selectedItem = if index != 'undefined' then stylebox.getItemAtIndex(index) else stylebox.selectedItem
  styleID = selectedItem.getAttribute('value')
  Zotero.BetterBibTeX.pref.set('auto-abbrev.style', styleID)
  Zotero.BetterBibTeX.keymanager.journalAbbrevCache = Object.create(null)
