diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index d7658862da4f3eb2f83816d55587bfaff43ccd64..c3fa7ff048c3b60ee051f604d53d16339fe8e3a3 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -1376,3 +1376,6 @@ char const* const _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->get
 char const* const _PREHASH_SeeAVs = LLMessageStringTable::getInstance()->getString("SeeAVs");
 char const* const _PREHASH_AnyAVSounds = LLMessageStringTable::getInstance()->getString("AnyAVSounds");
 char const* const _PREHASH_GroupAVSounds = LLMessageStringTable::getInstance()->getString("GroupAVSounds");
+char const* const _PREHASH_AppearanceData = LLMessageStringTable::getInstance()->getString("AppearanceData");
+char const* const _PREHASH_AppearanceVersion = LLMessageStringTable::getInstance()->getString("AppearanceVersion");
+char const* const _PREHASH_CofVersion = LLMessageStringTable::getInstance()->getString("CofVersion");
diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h
index da2b613f539022bc58bfaa2013d7b77272e365d1..92146820030674b5789f7914c35262512b19a81a 100644
--- a/indra/llmessage/message_prehash.h
+++ b/indra/llmessage/message_prehash.h
@@ -1376,4 +1376,7 @@ extern char const* const _PREHASH_ProductSKU;
 extern char const* const _PREHASH_SeeAVs;
 extern char const* const _PREHASH_AnyAVSounds;
 extern char const* const _PREHASH_GroupAVSounds;
+extern char const* const _PREHASH_AppearanceData;
+extern char const* const _PREHASH_AppearanceVersion;
+extern char const* const _PREHASH_CofVersion;
 #endif
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b7bb4e6b47ae19c21c4251efc44c46fffa0f1a30..0d85666d88a9294fcbe0b1b924373004be708b75 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -192,8 +192,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12;
 const F32 CHAT_FADE_TIME = 8.0;
 const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f;
 
-const S32 SERVER_GENERATED_APPEARANCE = 359949045;
-
 const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0);
 
 enum ERenderName
@@ -7355,12 +7353,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 	parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec);
 //	dumpAvatarTEs( "POST processAvatarAppearance()" );
 
-	// Extract COF Version field hacked into local texture id.
-	LLUUID flags_id = ((LLUUID*)tec.image_data)[0];
-	S32 this_update_cof_version = (flags_id.mData[0] << 24) + (flags_id.mData[1] << 16) +(flags_id.mData[2] << 8) +flags_id.mData[3];
-	S32 message_type = (flags_id.mData[4] << 24) + (flags_id.mData[5] << 16) +(flags_id.mData[6] << 8) +flags_id.mData[7];
+	U8 appearance_version = 0;
+	S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN;
+	S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion;
+	// For future use:
+	//U32 appearance_flags = 0;
+
+	if (mesgsys->has(_PREHASH_AppearanceData))
+	{
+		mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0);
+		mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0);
+		// For future use:
+		//mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0);
+	}
 
-	if (message_type == SERVER_GENERATED_APPEARANCE)
+	if (appearance_version > 0)
 	{
 		mUseServerBakes = true;
 	}
@@ -7369,19 +7376,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		mUseServerBakes = false;
 	}
 
-	S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion;
-
 	// Check for stale update.
-	if (isSelf() && mUseServerBakes)
+	if (mUseServerBakes && isSelf()
+		&& this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL
+		&& this_update_cof_version < last_update_request_cof_version)
 	{
-		if ((this_update_cof_version > 0) && 
-			(this_update_cof_version < last_update_request_cof_version))
-		{
-			llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version
-					<< ", got " << this_update_cof_version << llendl;
-			return;
-		}
-		((LLUUID*)tec.image_data)[0].setNull();
+		llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version
+				<< ", got " << this_update_cof_version << llendl;
+		return;
 	}
 	applyParsedTEMessage(tec);
 
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index 2cb0a833d4cfd94a926b7f4477be4b4a20cb8059..5b147db08433239803808f05d5fb6361b744f363 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -3571,6 +3571,12 @@ version 2.0
 		VisualParam			Variable
 		{	ParamValue		U8	}
 	}
+	{
+		AppearanceData		Variable
+		{	AppearanceVersion	U8	}
+		{	CofVersion			S32	}
+		{	Flags				U32	}
+	}
 }
 
 // AvatarSitResponse - response to a request to sit on an object
diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1
index 6486d92851a7590ef7ba205c7a40390290562e82..9e3dd21fb00c6d6a9e153f7336dc1660dced73e6 100644
--- a/scripts/messages/message_template.msg.sha1
+++ b/scripts/messages/message_template.msg.sha1
@@ -1 +1 @@
-465164e1a07f63d68c4ad1f00c19805dfb6ee2d7
\ No newline at end of file
+ac4e232bd595c8dd31bc67fd77bcf68d8e9e837c
\ No newline at end of file