           .on('submit', @__onStart)
           .submit()
 
-        complete = =>
-          @iframe.remove()
-          @iframeForm.remove()
+      __cleanUp: ->
+        @iframe.remove() if @iframe?
+        @iframeForm.remove() if @iframeForm?
+        @xhr = null
+        @iframe = null
+        @iframeForm = null
 
       __onError: => $(this).trigger('uploadcare.api.uploader.error')
       __onStart: => $(this).trigger('uploadcare.api.uploader.start')

          })
          .css('display', 'none')
          .appendTo('body')
          .on('load', (e) =>
            @__onLoad()
            complete()
          )
          .on('error', => @__onError(); complete())

        formParam = (name, value) ->
          $('<input>')


      cancel: ->
        @xhr.abort() if @xhr?
        @iframe.off('load error') if @iframe?
        @__cleanUp()

      __constructUuid: ->
        @fileId = utils.uuid()
