     self.db.open (err, db) ->
       throw err if err
       if $DEBUG
-        self.db.collection(self.dbName).remove()
+        self.db.collection(self.dbMessageName).remove()
         callback()
       else
         self.db.authenticate self.dbUser, self.dbPass, (err, res) ->
           throw err if err
-          self.db.collection(self.dbName).remove()
+          self.db.collection(self.dbMessageName).remove()
           callback()
 
   loadStringFilter: (sensitive_word_file) =>


  stringFilter: (text) =>
    self = this
    if self.sensitive_words.length == 0
      sensitive_word_files = fs.readdirSync(self.sensitive_word_file_dir)
      for sensitive_word_file in sensitive_word_files
        self.loadStringFilter("#{self.sensitive_word_file_dir}/#{sensitive_word_file}")

    safe_text = text
    for sensitive_word in self.sensitive_words
      switch sensitive_word.type

    if not (domain && domain.match(/^(?:[A-Za-z0-9\-\.]+\.)?phate\.(?:io|cc|us|tw|org)$/i)?)
      safe_referer = strip_hyper_links(strip_irc_colors(referer))
      throw "REFERRAL_DENIED: #{safe_referer}"

  loadBlacklist: =>
    self = this
    self.db.collection(self.dbConfigName).find(
      name: 'blacklist'
    ).sort(id: 1).toArray (err, items) ->
      throw err if err
      return if items.length == 0
      self.blacklist = JSON.parse(items[0].text)
      DEBUG('Load %d blacklist items from database.', Object.keys(self.blacklist).length)

  saveBlacklist: =>
    self = this
    criteria =
      name: 'blacklist'
    data =
      name: 'blacklist'
      text: JSON.stringify(self.blacklist)
    options =
      upsert: true
    self.db.collection(self.dbConfigName).update criteria, data, options, (err, count, status) ->
      throw err if err
      DEBUG('Save blacklist to database. Returned %s', status)

  blacklistCheck: (ip) =>
    self = this
