 				avcc.writeByte(ppsLength);
 				avcc.writeBytes(ppsNAL.NALdata, 0, ppsLength);
 				
-				tag.data = avcc;
-				
-				//	writeReturnTag(tag);
-				// doing this later on in the AUD
-				avccTag = tag;
+				// writeReturnTag(avccTag); // doing this later on in the AUD, doing it here may cause the decoder to skip frames.
+				
+				avccTag.data = avcc;
 				
 				spsNAL = null;
-				ppsNAL = null;
-				
-			}else if(avccTag){
-				//update the spsNAL nal if it exists
-				if (spsNAL) {
-					avcc = avccTag.data;
-					avcc.position = 1;
-					avcc.writeBytes(spsNAL.NALdata, 1, 3);
-					avcc.writeByte(0xff); // 111111 + 2 bit NAL size - 1
-					avcc.writeByte(0xe1); // number of SPS
-					avcc.writeByte(spsLength >> 8); // 16-bit SPS byte count
-					avcc.writeByte(spsLength);
-					avcc.writeBytes(spsNAL.NALdata, 0, spsLength); // the SPS
-				}
-				//update the ppsNAL nal if it exists
-				if (ppsNAL) {
-					avcc = avccTag.data;
-					avcc.position = 8;
-					var l:int = avcc.readByte();
-					avcc.position += l;
-					
-					avcc.writeByte(0x01); // number of PPS
-					avcc.writeByte(ppsLength >> 8); // 16-bit PPS byte count
-					avcc.writeByte(ppsLength);
-					avcc.writeBytes(ppsNAL.NALdata, 0, ppsLength);
-				}
+				ppsNAL = null;	
 			}
 			
 			//http://gentlelogic.blogspot.nl/2011/11/exploring-h264-part-2-h264-bitstream.html

				var dStart:uint = packet.position;	// assume that the copy will be from start-of-data

			var nal:HTTPStreamingH264NALU;
			var avccTag:FLVTagVideo = null;
			if(flush)
			{
				nal = new HTTPStreamingH264NALU(_nalData); // full length to end, don't need to trim last 3 bytes

				avcc = new ByteArray();
				var spsLength:Number = spsNAL.length;
				var ppsLength:Number = ppsNAL.length;
				avccTag = new FLVTagVideo();
				
				//tag.timestamp = _timestamp;
				avccTag.codecID = FLVTagVideo.CODEC_ID_AVC;
				avccTag.frameType = FLVTagVideo.FRAME_TYPE_KEYFRAME;
				avccTag.avcPacketType = FLVTagVideo.AVC_PACKET_TYPE_SEQUENCE_HEADER;
				
				avcc.writeByte(0x01); // avcC version 1
				// profile, compatibility, level
