diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 223f754c2e846e6e13b39ede37b9c4a973d183a6..f4b6ff318b198d93f1d0cc671c2b9a608c78bb41 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -347,12 +347,23 @@ class BaseCapabilitiesCompleteTracker :  public LLHTTPClient::Responder
 			//	++iter;
 			//}
 
-			regionp->getRegionImplNC()->mSecondCapabilitiesTracker.clear();
+			if (regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() > regionp->getRegionImpl()->mCapabilities.size() )
+			{
+				// *HACK Since we were granted more base capabilities in this grant request than the initial, replace
+				// the old with the new. This shouldn't happen i.e. we should always get the same capabilities from a
+				// sim. The simulator fix from SH-3895 should prevent it from happening, at least in the case of the
+				// inventory api capability grants.
+
+				// Need to clear a std::map before copying into it because old keys take precedence.
+				regionp->getRegionImplNC()->mCapabilities.clear();
+				regionp->getRegionImplNC()->mCapabilities = regionp->getRegionImpl()->mSecondCapabilitiesTracker;
+			}
 		}
 		else
 		{
 			LL_DEBUGS("CrossingCaps") << "Sim sent multiple base cap grants with matching sizes." << LL_ENDL;
 		}
+		regionp->getRegionImplNC()->mSecondCapabilitiesTracker.clear();
 	}