diff --git a/etc/config.csh/setup b/etc/config.csh/setup
index 7f02c0dcb6ecbefa8d08e162d9f9791e3d26a35d..842efd0e6bc9a6335a9c0b6595b5f8df819e49c6 100644
--- a/etc/config.csh/setup
+++ b/etc/config.csh/setup
@@ -45,16 +45,17 @@ source "$WM_PROJECT_DIR/etc/config.csh/functions"
 setenv WM_THIRD_PARTY_DIR
 set foundDir=''
 _foamEcho "Locating ThirdParty directory"
-foreach WM_THIRD_PARTY_DIR (\
+foreach foamDir (\
     "$WM_PROJECT_DIR/ThirdParty" \
     "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
     "$prefixDir/ThirdParty-v$WM_PROJECT_API" \
     "$prefixDir/ThirdParty-$WM_PROJECT_API" \
     "$prefixDir/ThirdParty-common" \
 )
-    _foamEcho "... $WM_THIRD_PARTY_DIR"
-    if ( -d "$WM_THIRD_PARTY_DIR" ) then
-        if ( -f "$WM_THIRD_PARTY_DIR/Allwmake" || -d "$WM_THIRD_PARTY_DIR/platforms" ) then
+    _foamEcho "... $foamDir"
+    if ( -d "$foamDir" ) then
+        if ( -f "$foamDir/Allwmake" || -d "$foamDir/platforms" ) then
+            setenv WM_THIRD_PARTY_DIR "$foamDir"
             set foundDir=true
             break
         endif
@@ -182,6 +183,6 @@ unalias _foamAddLib
 unalias _foamAddLibAuto
 
 # Variables (done as final statement for a clean exit code)
-unset cleaned foamOldDirs foundDir prefixDir
+unset cleaned foamOldDirs foundDir foamDir prefixDir
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index b35cef97ef9c0e0f865f7af1d1c9ddf39b2742b3..3041f8931a973ced95b85f6e66432900d2c04263 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -43,6 +43,7 @@ unsetenv WM_ARCH_OPTION
 unsetenv WM_CC
 unsetenv WM_CFLAGS
 unsetenv WM_COMPILER
+unsetenv WM_COMPILER_ARCH
 unsetenv WM_COMPILER_TYPE
 unsetenv WM_COMPILER_LIB_ARCH
 unsetenv WM_COMPILE_OPTION