diff --git a/.firefox.metadata b/.firefox.metadata
index 7278b06..fbd04ec 100644
--- a/.firefox.metadata
+++ b/.firefox.metadata
@@ -1,2 +1,2 @@
-fed1ce45266ba990bbc44c1248368f6f9e122277 SOURCES/firefox-38.0esr.source.tar.bz2
-181886c28f0bc83a63159daa934b940a131156f4 SOURCES/firefox-langpacks-38.0esr-20150506.tar.bz2
+87364e16f99b172e677e245fa0805972d8b35070 SOURCES/firefox-38.0.1esr.source.tar.bz2
+a3504ff7a15f58ec8175b7774769f78fcb0785c7 SOURCES/firefox-langpacks-38.0.1esr-20150515.tar.bz2
diff --git a/.gitignore b/.gitignore
index 24b1edf..b4d3ef8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-SOURCES/firefox-38.0esr.source.tar.bz2
-SOURCES/firefox-langpacks-38.0esr-20150506.tar.bz2
+SOURCES/firefox-38.0.1esr.source.tar.bz2
+SOURCES/firefox-langpacks-38.0.1esr-20150515.tar.bz2
diff --git a/SOURCES/firefox-centos-default-prefs.js b/SOURCES/firefox-centos-default-prefs.js
deleted file mode 100644
index 2b5da25..0000000
--- a/SOURCES/firefox-centos-default-prefs.js
+++ /dev/null
@@ -1,28 +0,0 @@
-pref("app.update.auto",                     false);
-pref("app.update.enabled",                  false);
-pref("app.update.autoInstallEnabled",       false);
-pref("browser.backspace_action",            2);
-pref("browser.display.use_system_colors",   true);
-pref("browser.download.folderList",         1);
-pref("browser.link.open_external",          3);
-pref("browser.shell.checkDefaultBrowser",   false);
-pref("general.smoothScroll",                true);
-pref("general.useragent.vendor",            "CentOS");
-pref("general.useragent.vendorSub",         "FIREFOX_RPM_VR");
-pref("intl.locale.matchOS",                 true);
-pref("storage.nfs_filesystem",              false);
-pref("dom.ipc.plugins.enabled.nswrapper*",  false);
-pref("network.manage-offline-status",       true);
-pref("toolkit.networkmanager.disable", false);
-pref("browser.startup.homepage",            "data:text/plain,browser.startup.homepage=file:///usr/share/doc/HTML/index.html");
-pref("toolkit.storage.synchronous",         0);
-pref("startup.homepage_override_url",       "http://www.centos.org");
-pref("startup.homepage_welcome_url",        "http://www.centos.org");
-/* Workaround for rhbz#1134876 */
-pref("javascript.options.baselinejit",      false);
-pref("extensions.shownSelectionUI",         true);
-/* Workaround for rhbz#1110291 */
-pref("network.negotiate-auth.allow-insecure-ntlm-v1", true);
-/* Workaround for mozbz#1063315 */
-pref("security.use_mozillapkix_verification", false);
-pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
diff --git a/SOURCES/firefox.sh.in b/SOURCES/firefox.sh.in
index 59f4a20..2a0dfc9 100644
--- a/SOURCES/firefox.sh.in
+++ b/SOURCES/firefox.sh.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # The contents of this file are subject to the Netscape Public
 # License Version 1.1 (the "License"); you may not use this file
@@ -168,9 +168,9 @@ FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-langpack-install"
 # MOZ_DISABLE_LANGPACKS disables language packs completely
 MOZILLA_DOWN=0
 if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
-    if [ -x $MOZ_DIST_BIN/mozilla-xremote-client ]; then
+    if [ -x $MOZ_DIST_BIN/$MOZ_FIREFOX_FILE ]; then
         # Is firefox running?
-        $MOZ_DIST_BIN/mozilla-xremote-client -a firefox 'ping()' > /dev/null 2>&1
+        $MOZ_DIST_BIN/$MOZ_FIREFOX_FILE -remote 'ping()' > /dev/null 2>&1
         MOZILLA_DOWN=$?
     fi
 fi
@@ -185,7 +185,6 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
         rm `cat $FEDORA_LANGPACK_CONFIG` > /dev/null 2>&1
         rm $FEDORA_LANGPACK_CONFIG > /dev/null 2>&1
         # remove all empty langpacks dirs while they block installation of langpacks
-        # (rhbz#1067343)
         rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
     fi
 
@@ -194,8 +193,7 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
     CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
     CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG}
 
-    # Try without a local variant first, then with a local variant
-    # So that pt-BR doesn't try to use pt for example
+    # Try with a local variant first, then without a local variant
     SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"`
     MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"`
 
@@ -204,6 +202,11 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
         local langpack=langpack-${language}@firefox.mozilla.org.xpi
         if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then
             rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
+            # If the target file is a symlink (the fallback langpack), 
+            # install the original file instead of the fallback one
+            if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then
+                langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack`
+            fi
             ln -s $MOZ_LANGPACKS_DIR/$langpack \
                   $MOZ_EXTENSIONS_PROFILE_DIR/$langpack
             echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG
@@ -212,10 +215,10 @@ if [ $MOZILLA_DOWN -ne 0 ]; then
         return 1
     }
 
-    create_langpack_link $SHORTMOZLOCALE || create_langpack_link $MOZLOCALE || true
+    create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true
 fi
 
-# BEAST fix (rhbz#838879)
+# BEAST fix (rhbz#1005611)
 NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
 export NSS_SSL_CBC_RANDOM_IV
 
diff --git a/SPECS/firefox.spec b/SPECS/firefox.spec
index 0a4a9bf..69d683d 100644
--- a/SPECS/firefox.spec
+++ b/SPECS/firefox.spec
@@ -53,19 +53,19 @@
 
 Summary:        Mozilla Firefox Web browser
 Name:           firefox
-Version:        38.0
-Release:        3%{?prever}%{?dist}
+Version:        38.0.1
+Release:        1%{?prever}%{?dist}
 URL:            http://www.mozilla.org/projects/firefox/
 License:        MPLv1.1 or GPLv2+ or LGPLv2+
 Group:          Applications/Internet
 # From ftp://ftp.mozilla.org/pub/firefox/releases/%{version}%{?pretag}/source
 Source0:        firefox-%{version}%{?prever}%{?ext_version}.source.tar.bz2
 %if %{build_langpacks}
-Source1:        firefox-langpacks-%{version}%{?ext_version}-20150506.tar.bz2
+Source1:        firefox-langpacks-%{version}%{?ext_version}-20150515.tar.bz2
 %endif
 Source10:       firefox-mozconfig
 Source11:       firefox-mozconfig-branded
-Source12:       firefox-centos-default-prefs.js
+Source12:       firefox-redhat-default-prefs.js
 Source20:       firefox.desktop
 Source21:       firefox.sh.in
 Source23:       firefox.1
@@ -175,13 +175,6 @@ Obsoletes:      firefox < 24.1.0
 Conflicts:      firefox < 24.1.0
 Provides:       webclient
 
-
-# BUILDEQUIRES from yelp
-BuildRequires:  bison
-BuildRequires:  byacc
-BuildRequires:  xmlto
-BuildRequires:  gettext-devel
-
 %define _use_internal_dependency_generator 0
 %define __find_requires %{SOURCE100}
 
@@ -204,10 +197,8 @@ cd %{tarballdir}
 %patch7 -p1 -b .no-format
 %patch8 -p2 -b .ppc64le
 %if %{?debug_build}
-%ifnarch %{ix86} x86_64
 %patch9 -p1 -b .debug
 %endif
-%endif
 %patch10 -p1 -b .nss-3.18.0
 %patch11 -p1 -b .nspr-prbool
 
@@ -354,15 +345,6 @@ make -f client.mk build STRIP="/bin/true" MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS"
 cd %{tarballdir}
 %{__rm} -rf $RPM_BUILD_ROOT
 
-# set up our prefs and add it to the package manifest file, so it gets pulled in
-# to omni.jar which gets created during make install
-%{__cp} %{SOURCE12} objdir/dist/bin/browser/defaults/preferences/all-redhat.js
-# This sed call "replaces" firefox.js with all-redhat.js, newline, and itself (&)
-# having the net effect of prepending all-redhat.js above firefox.js
-%{__sed} -i -e\
-    's|@BINPATH@/browser/@PREF_DIR@/firefox.js|@BINPATH@/browser/@PREF_DIR@/all-redhat.js\n&|' \
-    browser/installer/package-manifest.in
-
 # set up our default bookmarks
 %{__cp} -p %{default_bookmarks_file} objdir/dist/bin/browser/defaults/profile/bookmarks.html
 
@@ -417,6 +399,32 @@ for langpack in `ls firefox-langpacks/*.xpi`; do
   echo "%%lang($language) %{langpackdir}/${extensionID}.xpi" >> ../%{name}.lang
 done
 %{__rm} -rf firefox-langpacks
+
+# Install langpack workaround (see #707100, #821169)
+function create_default_langpack() {
+language_long=$1
+language_short=$2
+cd $RPM_BUILD_ROOT%{langpackdir}
+ln -s langpack-$language_long@firefox.mozilla.org.xpi langpack-$language_short@firefox.mozilla.org.xpi
+cd -
+echo "%%lang($language_short) %{langpackdir}/langpack-$language_short@firefox.mozilla.org.xpi" >> ../%{name}.lang
+}
+
+# Table of fallbacks for each language
+# please file a bug at bugzilla.redhat.com if the assignment is incorrect
+create_default_langpack "bn-IN" "bn"
+create_default_langpack "es-AR" "es"
+create_default_langpack "fy-NL" "fy"
+create_default_langpack "ga-IE" "ga"
+create_default_langpack "gu-IN" "gu"
+create_default_langpack "hi-IN" "hi"
+create_default_langpack "hy-AM" "hy"
+create_default_langpack "nb-NO" "nb"
+create_default_langpack "nn-NO" "nn"
+create_default_langpack "pa-IN" "pa"
+create_default_langpack "pt-PT" "pt"
+create_default_langpack "sv-SE" "sv"
+create_default_langpack "zh-TW" "zh"
 %endif # build_langpacks
 
 # Keep compatibility with the old preference location.
@@ -424,6 +432,9 @@ done
 %{__mkdir_p} $RPM_BUILD_ROOT/%{mozappdir}/browser/defaults
 ln -s %{mozappdir}/defaults/preferences $RPM_BUILD_ROOT/%{mozappdir}/browser/defaults/preferences
 
+# Install default ones
+%{__cp} %{SOURCE12} ${RPM_BUILD_ROOT}%{mozappdir}/defaults/preferences/all-redhat.js
+
 # System extensions
 %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/mozilla/extensions/%{firefox_app_id}
 %{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/mozilla/extensions/%{firefox_app_id}
@@ -499,7 +510,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{mozappdir}/firefox-bin
 %{mozappdir}/run-mozilla.sh
 %{mozappdir}/application.ini
-%dir %{mozappdir}/defaults/preferences
+%{mozappdir}/defaults/preferences/*
 %{mozappdir}/browser/defaults/preferences
 %exclude %{mozappdir}/removed-files
 %{mozappdir}/webapprt-stub
@@ -511,7 +522,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{mozappdir}/components/*.manifest
 %{mozappdir}/dictionaries
 %{mozappdir}/*.so
-#%{mozappdir}/mozilla-xremote-client FIXME
 %{mozappdir}/omni.ja
 %{mozappdir}/platform.ini
 %{mozappdir}/plugin-container
@@ -530,8 +540,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 #---------------------------------------------------------------------
 
 %changelog
-* Tue May 12 2015 CentOS Sources <bugs@centos.org> - 38.0-3.el7.centos
-- CentOS default prefs
+* Fri May 15 2015 Martin Stransky <stransky@redhat.com> - 38.0-5
+- Update to 38.0.1 ESR
+
+* Thu May 14 2015 Martin Stransky <stransky@redhat.com> - 38.0-4
+- Fixed rhbz#1221286 - After update to Firefox 38 ESR
+  all RH preferences are gone
 
 * Thu May  7 2015 Martin Stransky <stransky@redhat.com> - 38.0-3
 - Enabled system nss