 									break;
 								}
 							} else {
-								decryptToBuffer(input, 16);
+								if (!decryptToBuffer(input, 16)) {
+									break;
+								}
 							}
 							if (_decryptBuffer.readByte() == 0x47) {
 								_syncFound = true;

			return output.length === 0 ? null : output;
		}
		
		private function decryptToBuffer(input:IDataInput, blockSize:int):void{
			if (_key) {
				// Clear buffer
				if (_decryptBuffer.bytesAvailable == 0) {
					_decryptBuffer.clear();
				}
				if (_key.type == "AES-128" && blockSize % 16 == 0) {
					// Save buffer position
					var currentPosition:uint = _decryptBuffer.position;
					_decryptBuffer.position += _decryptBuffer.bytesAvailable;

							} else {
								var bytesLeft:uint = input.bytesAvailable - 176;
								if (bytesLeft > 0 && bytesLeft < 15) {
									if (!decryptToBuffer(input, input.bytesAvailable)) {
										break;
									}
								} else {
									if (!decryptToBuffer(input, 176)) {
										break;
									}
								}
							}
							_decryptBuffer.readBytes(packet, 0, 187);
