 
         return false if not tabCls
 
-        tab = new tabCls(this, @settings, selectedFileCallback)
+        tab = new tabCls this, @settings, @fileSelected.bind(this)
 
         if tab
           $('<li>')

      addTab: (name) ->
        {tabs} = uploadcare.widget

        selectedFileCallback = @fileSelected.bind(this)
        
        tabCls = switch name
          when 'file' then tabs.FileTab
          when 'url' then tabs.UrlTab

          .hide()
          .appendTo('body')

        @content.on 'click', (e) =>
          e.stopPropagation()
          @close() if e.target == e.currentTarget

        closeButton = @content.find('@uploadcare-dialog-close')
        closeButton.on 'click', @close.bind(this)

        $(window).on 'keydown', (e) =>
          @close(e) if e.which == 27 # Escape

        @tabs = {}
        for tabName in @tabNames when tabName not of @tabs
