diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 7d4bbad5958d84eb9c2c5cbc9c52bf28301d4ca6..d4ed0d93b5e5ba682e9ab63ce3f99d0ef4f7e144 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -755,7 +755,8 @@ def setup_package(pkg, dirty):
         # kludge to handle cray libsci being automatically loaded by PrgEnv
         # modules on cray platform. Module unload does no damage when
         # unnecessary
-        module('unload', 'cray-libsci')
+        if False:
+            module('unload', 'cray-libsci')
 
         if pkg.architecture.target.module_name:
             load_module(pkg.architecture.target.module_name)
diff --git a/lib/spack/spack/util/module_cmd.py b/lib/spack/spack/util/module_cmd.py
index bc994fd4b4442e468186a358ba8ed9ed8ccb8fce..1ee25f79be630c48565ca84fd6e3ed9101529207 100644
--- a/lib/spack/spack/util/module_cmd.py
+++ b/lib/spack/spack/util/module_cmd.py
@@ -99,14 +99,17 @@ def load_module(mod):
     # We do this without checking that they are already installed
     # for ease of programming because unloading a module that is not
     # loaded does nothing.
-    text = module('show', mod).split()
-    for i, word in enumerate(text):
-        if word == 'conflict':
-            module('unload', text[i + 1])
-
-    # Load the module now that there are no conflicts
-    # Some module systems use stdout and some use stderr
-    module('load', mod)
+    if 'PrgEnv' not in mod:
+        module('swap', mod)
+    else:
+        text = module('show', mod).split()
+        for i, word in enumerate(text):
+            if word == 'conflict':
+                module('unload', text[i + 1])
+
+        # Load the module now that there are no conflicts
+        # Some module systems use stdout and some use stderr
+        module('load', mod)
 
 
 def get_path_args_from_module_line(line):