   # so, cleanup() won't clean up if there hasn't been an emit()
   cleanup: ->
     clean = @_cleanListeners
-    @_info = @_info.filter (info) -> clean(info.listeners).length > 0
+    @_info = @_info.filter (info) ->
+      # let's also rebuild the listeners array
+      info.listeners = info.listeners.filter (el) -> el?
+      clean(info.listeners).length > 0
 
 
   # look thru array and shift existing elements left to compact them together.

      return



module.exports = (options, dir) -> new Eventa options, dir

    arg[0] is '.' and (arg[1] is '/' or (arg[1] is '.' and arg[2] is '/'))


  load: (thing, options, dir) ->

    if Array.isArray thing
      @load each, options, dir for each in thing
      return

    if typeof options is 'string'
      dir = options
      options = null

    # now we know it's not an array argument, and we know the options and dir.
    switch typeof thing

      when 'string'

        if @_isLocalPath thing

          # get resolve if we haven't already
          @resolve ?= require('path').resolve

          # resolve against the provided base dir or '.'
          thing = @resolve dir ? '.', thing

        require(thing)(this, options)

      when 'function' then thing this, options

      else console.error 'invalid type of argument for load():', thing

    return


  # forward an event emitted on this Eventa to another `target` emitter
