 			
 			trace("Zlib.compress. compressed.length: " + compressed.length);
 			trace("Zlib.compress. compressed: " + compressed.toString());
-			
+
+			compressed.position = 0;
 			return compressed;
 		}
 		

			checkError(stream, err, "inflateEnd");
			
			
			// Checking ... is this needed?
			data.position = 0;
			for (i = 0; i < data.length; i++)
			{
				if (data.readByte() == 0)
				{
					break;
				}
			}
			
			uncompressed.position = 0;
			for (j = 0; j < uncompressed.length; j++)
			{
				if (uncompressed.readByte() == 0)
				{
					break;
				}
			}
			
			if (i == j)
			{
				uncompressed.position = 0;
				data.position = 0;
				for (i = 0; i < j; i++)
				{
					if (data.readByte() != uncompressed.readByte())
					{
						break;
					}
				}
				if (i == j)
				{
					trace("inflate(): " + String(uncompressed));
					//return;
				}
			}
			else
			{
				trace("bad inflate");
			}
			
			
			trace("Zlib.uncompress. uncompressed.length: " + uncompressed.length);
			trace("Zlib.uncompress. uncompressed: " + uncompressed.toString());
			
			return uncompressed;
		}
		
		/**
		 * Compress the given ByteArray. Will add Adler32 checksum to the end of the data.
		 *
		 * @param	data
		 * @return Compressed data

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