 			stream.next_in = data;
 			stream.next_in_index = 0;
 			
-			stream.next_out = uncompressed;
+			stream.next_out = chunk;
 			stream.next_out_index = 0;
 			
 			stream.avail_out = outBytesLength;

			data.position = 0;
			var compressed:ByteArray = new ByteArray();
			var err:int;
			var i:int = 0;
			var j:int = 0;
			
			trace("Zlib.compress. data.length: " + data.length);
			trace("Zlib.compress. data: " + data.toString());
			
			var stream:ZStream = new ZStream();

			err = stream.deflateInit(JZlib.Z_BEST_COMPRESSION);

		{
			data.position = 0;
			var uncompressed:ByteArray = new ByteArray();
			var chunk:ByteArray = new ByteArray();
			var outBytesLength:int = data.length * 2;
			
			var err:int;
