diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php
index d5c39145e9e74244ee43cb5dfbdce20d26cf863b..5b247f00b0567e1c569a97cfd384d84698c6e1b8 100644
--- a/CRM/Core/Resources.php
+++ b/CRM/Core/Resources.php
@@ -205,7 +205,8 @@ class CRM_Core_Resources {
       CRM_Core_Region::instance('html-header')->add(array(
         'callback' => function(&$snippet, &$html) use ($resources) {
           $html .= "\n" . $resources->renderSetting();
-        }
+        },
+        'weight' => -100000,
       ));
       $this->addedSettings = TRUE;
     }
@@ -261,7 +262,7 @@ class CRM_Core_Resources {
    * @return string
    */
   public function renderSetting() {
-    $js = 'var CRM = cj.extend(true, ' . json_encode($this->getSettings()) . ', CRM || {});';
+    $js = 'var CRM = ' . json_encode($this->getSettings()) . ';';
     return sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $js);
   }
 
diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php
index d644e1bbbc89d48ba24f5ae95c7c082e23d3557f..518d85f439c79ab9abbd660a86ad82323017fdf6 100644
--- a/CRM/Utils/System/Joomla.php
+++ b/CRM/Utils/System/Joomla.php
@@ -261,11 +261,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @access public
    */
   public function addScriptUrl($url, $region) {
-    if ($region == 'html-header') {
-      $document = JFactory::getDocument();
-      $document->addScript($url);
-      return TRUE;
-    }
     return FALSE;
   }
 
@@ -282,11 +277,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @access public
    */
   public function addScript($code, $region) {
-    if ($region == 'html-header') {
-      $document = JFactory::getDocument();
-      $document->addScriptDeclaration($code);
-      return TRUE;
-    }
     return FALSE;
   }