diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h
index 5f52bc0b1583899fa190ed9cce745f0bf2e45e0b..da9d98c16ce0d75d0907ae706db00073db4e8433 100644
--- a/indra/llcommon/llalignedarray.h
+++ b/indra/llcommon/llalignedarray.h
@@ -116,7 +116,7 @@ void LLAlignedArray<T, alignment>::resize(U32 size)
 template <class T, U32 alignment>
 T& LLAlignedArray<T, alignment>::operator[](int idx)
 {
-	if(idx >= mElementCount)
+	if(idx >= mElementCount || idx < 0)
     {
         LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
     }
@@ -126,7 +126,7 @@ T& LLAlignedArray<T, alignment>::operator[](int idx)
 template <class T, U32 alignment>
 const T& LLAlignedArray<T, alignment>::operator[](int idx) const
 {
-    if (idx >= mElementCount)
+    if (idx >= mElementCount || idx < 0)
     {
         LL_ERRS() << "Out of bounds LLAlignedArray, requested: " << (S32)idx << " size: " << mElementCount << LL_ENDL;
     }
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 0be748ace9df10e4938a526acfdec8ffaaa96a24..e395da7f1e66d29e6f9e709cf2243e423a1389c9 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -327,22 +327,63 @@ void LLFriendCardsManager::syncFriendCardsFolders()
 /************************************************************************/
 /*		Private Methods                                                 */
 /************************************************************************/
-const LLUUID& LLFriendCardsManager::findFriendFolderUUIDImpl() const
+const LLUUID& LLFriendCardsManager::findFirstCallingCardSubfolder(const LLUUID &parent_id) const
 {
-	const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+    if (parent_id.isNull())
+    {
+        return LLUUID::null;
+    }
 
-	std::string friendFolderName = get_friend_folder_name();
+    LLInventoryModel::cat_array_t* cats;
+    LLInventoryModel::item_array_t* items;
+    gInventory.getDirectDescendentsOf(parent_id, cats, items);
 
-	return findChildFolderUUID(callingCardsFolderID, friendFolderName);
+    if (!cats || !items || cats->size() == 0)
+    {
+        // call failed
+        return LLUUID::null;
+    }
+
+    if (cats->size() > 1)
+    {
+        const LLViewerInventoryCategory* friendFolder = gInventory.getCategory(parent_id);
+        if (friendFolder)
+        {
+            LL_WARNS_ONCE() << friendFolder->getName() << " folder contains more than one folder" << LL_ENDL;
+        }
+    }
+
+    for (LLInventoryModel::cat_array_t::const_iterator iter = cats->begin();
+        iter != cats->end();
+        ++iter)
+    {
+        const LLInventoryCategory* category = (*iter);
+        if (category->getPreferredType() == LLFolderType::FT_CALLINGCARD)
+        {
+            return category->getUUID();
+        }
+    }
+
+    return LLUUID::null;
 }
 
-const LLUUID& LLFriendCardsManager::findFriendAllSubfolderUUIDImpl() const
+// Inventorry ->
+//   Calling Cards - >
+//     Friends - > (the only expected folder)
+//       All (the only expected folder)
+
+const LLUUID& LLFriendCardsManager::findFriendFolderUUIDImpl() const
 {
-	LLUUID friendFolderUUID = findFriendFolderUUIDImpl();
+    const LLUUID callingCardsFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
+
+    return findFirstCallingCardSubfolder(callingCardsFolderID);
+}
 
-	std::string friendAllSubfolderName = get_friend_all_subfolder_name();
+const LLUUID& LLFriendCardsManager::findFriendAllSubfolderUUIDImpl() const
+{
+    LLUUID friendFolderUUID = findFriendFolderUUIDImpl();
 
-	return findChildFolderUUID(friendFolderUUID, friendAllSubfolderName);
+    return findFirstCallingCardSubfolder(friendFolderUUID);
 }
 
 const LLUUID& LLFriendCardsManager::findChildFolderUUID(const LLUUID& parentFolderUUID, const std::string& nonLocalizedName) const
diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h
index 2fb912a93048b87340a4b6e4e8d32e0a230f14f6..f5679d7d85d97749e494f803895bd11b866be87e 100644
--- a/indra/newview/llfriendcard.h
+++ b/indra/newview/llfriendcard.h
@@ -116,6 +116,7 @@ class LLFriendCardsManager
 	}
 
 	const LLUUID& findChildFolderUUID(const LLUUID& parentFolderUUID, const std::string& nonLocalizedName) const;
+    const LLUUID& findFirstCallingCardSubfolder(const LLUUID &parent_id) const;
 	const LLUUID& findFriendFolderUUIDImpl() const;
 	const LLUUID& findFriendAllSubfolderUUIDImpl() const;
 	const LLUUID& findFriendCardInventoryUUIDImpl(const LLUUID& avatarID);