diff --git a/admin/tool/customlang/locallib.php b/admin/tool/customlang/locallib.php
index 83e879a8..b2f3fe23 100644
--- a/admin/tool/customlang/locallib.php
+++ b/admin/tool/customlang/locallib.php
@@ -122,6 +122,7 @@ class tool_customlang_utils {
                      WHERE lang = ? AND componentid = ?
                   ORDER BY stringid";
             $current = $DB->get_records_sql($sql, array($lang, $component->id));
+            $current = array_change_key_case($current, CASE_LOWER);
             $english = $stringman->load_component_strings($component->name, 'en', true, true);
             if ($lang == 'en') {
                 $master =& $english;
@@ -141,6 +142,7 @@ class tool_customlang_utils {
                     $progressbar->update_full($donepercent, $strinprogress);
                 }

+                $stringid = strtolower($stringid);
                 if (isset($current[$stringid])) {
                     $needsupdate     = false;
                     $currentoriginal = $current[$stringid]->original;
