diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 89335a20f5d9d771a0d0c27b8baa1c56f5b124ed..abc5a95c8ddd89d01ca18c9448a391e31f3fb7fb 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -435,6 +435,15 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
     //    return;
     //}
 
+    LLVector3 constrained_pos = LLVector3(llclamp(pos[0],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET),
+                                          llclamp(pos[1],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET),
+                                          llclamp(pos[2],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET));
+    if (constrained_pos != pos)
+    {
+        LL_DEBUGS("Avatar") << "attachment pos override constrained to " 
+                            << constrained_pos << " was " << pos << LL_ENDL;
+    }
+    
     LLVector3 before_pos;
     LLUUID before_mesh_id;
     bool has_active_override_before = hasAttachmentPosOverride( before_pos, before_mesh_id );
@@ -446,7 +455,7 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
 		}
 		m_posBeforeOverrides = getPosition();
 	}
-	m_attachmentPosOverrides.add(mesh_id,pos);
+	m_attachmentPosOverrides.add(mesh_id,constrained_pos);
     LLVector3 after_pos;
     LLUUID after_mesh_id;
     hasAttachmentPosOverride(after_pos, after_mesh_id);
@@ -455,7 +464,7 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh
         active_override_changed = true; 
         if (do_debug_joint(getName()))
         {
-            LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " addAttachmentPosOverride for mesh " << mesh_id << " pos " << pos << LL_ENDL;
+            LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " addAttachmentPosOverride for mesh " << mesh_id << " pos " << constrained_pos << LL_ENDL;
         }
         updatePos(av_info);
     }
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index a181d8be9a5a7571a9fbf7c839507260e8831bd1..e77c7615e9dc8f9fc944a4be0c29eae3ed190986 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -294,7 +294,7 @@ void LLControlAvatar::updateDebugText()
                               active_string.c_str(), (S32) isImpostor(), streaming_cost));
         addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str()));
         addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts));
-        addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str()));
+        addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank()));
 #if 0
         std::string region_name = "no region";
         if (mRootVolp->getRegion())
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index f00f855160edcc6a0bd28978546a1a44422ea180..cccf857eba8f4dc747f2185f153213bd1ec8d8e2 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -747,6 +747,7 @@ class LLVOAvatar :
 public:
 	BOOL			isVisible() const;
 	void			setVisibilityRank(U32 rank);
+    U32				getVisibilityRank() const { return mVisibilityRank; }
 	static S32 		sNumVisibleAvatars; // Number of instances of this class
 /**                    Appearance
  **                                                                            **
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index ba733f93870257546fea427abf1526fe39610cf3..bf646eb44b19f1b0403ec68a7200c387d4938720 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3932,6 +3932,10 @@ F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_v
 	{
         if (isAnimatedObject() && isRiggedMesh())
         {
+            if (unscaled_value)
+            {
+                *unscaled_value = (linkset_base_cost + ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * getEstTrianglesStreamingCost())/0.06;
+            }
             return linkset_base_cost + ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * getEstTrianglesStreamingCost();
         }
         else