diff --git a/detect_environment.py b/detect_environment.py
index f063f5e9167d19a104b8084a60154b9f412f5d74..83d864ebe12d58dfcc46dc5e44372f07a25b55f8 100644
--- a/detect_environment.py
+++ b/detect_environment.py
@@ -11,9 +11,9 @@ def lcg():
 
     # The CMAKE_PREFIX_PATH seems to point to the root of the environment.
     location = os.environ.get('CMAKE_PREFIX_PATH')
-    setup = isfile(join(location, 'setup.sh'))
+    setup = join(location, 'setup.sh')
     if not isfile(setup):
-        raise ValueError('Could not LCG setup.sh')
+        raise ValueError('Could not find LCG setup.sh')
 
     return 'source ' + setup