 		public function advancedUpload(url:String, settings:Object):void {
 			var file:File = this, width:int, height:int, quality:int, multipart:Boolean, chunking:Boolean, fileDataName:String;
 			var chunk:int, chunks:int, chunkSize:int, postvars:Object;
-			var onComplete:Function, onIOError:Function,
-				removeAllListeneres:Function = function() : void {
+			var onComplete:Function, onIOError:Function;
+			var removeAllListeners:Function = function() : void {
 					file._fileRef.removeEventListener(Event.COMPLETE, onComplete);
 					file._fileRef.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
 				};

			var file:File = this, fileData:ByteArray, chunkData:ByteArray, req:URLRequest, url:String;
			var onComplete:Function, onIOError:Function, onSecurityError:Function;
			var removeAllEventListeners:Function = function() : void {
				file._urlStream.removeEventListener(Event.COMPLETE, onComplete);
				file._urlStream.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
				file._urlStream.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
			};

			// All chunks uploaded?
			if (this._chunk >= this._chunks) {

		{
			if (this.canUseSimpleUpload(this._settings)) {
				this._fileRef.cancel();
			} else if (!this._urlStream) {
				// In case of a large file and before _fileRef.load#COMPLETE.
				// Need to cancel() twice, not sure why.
				// If single cancel(), #2037 will occurred at _fileRef.load().
				this._fileRef.cancel();
				this._fileRef.cancel();
				this._removeAllListeners();
			} else if (this._urlStream.connected) {
				// just in case
				this._removeAllURLStreamListeners();

				this._urlStream.close();

				// In case of a large file and after the first uploadNextChunk().
				// #2174 will occur at _fileRef.load() and
				// #2029 will occur at _urlStream.readUTFBytes as well
				// after loading file is stopped before _fileRef.load#COMPLETE.
		
				// Uploaded file will be broken as well if the following line does not exist.
				this._urlStream = null;
			} 
		}

		/**
