Index: build/full.cfg
===================================================================
--- build/full.cfg	(revision 10821)
+++ build/full.cfg	(working copy)
@@ -3,7 +3,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js
Index: build/library.cfg
===================================================================
--- build/library.cfg	(revision 10821)
+++ build/library.cfg	(working copy)
@@ -4,7 +4,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js
Index: build/lite.cfg
===================================================================
--- build/lite.cfg	(revision 10821)
+++ build/lite.cfg	(working copy)
@@ -6,7 +6,6 @@
 
 [first]
 OpenLayers/SingleFile.js
-OpenLayers.js
 OpenLayers/BaseTypes.js
 OpenLayers/BaseTypes/Class.js
 OpenLayers/Util.js
Index: lib/OpenLayers/SingleFile.js
===================================================================
--- lib/OpenLayers/SingleFile.js	(revision 10821)
+++ lib/OpenLayers/SingleFile.js	(working copy)
@@ -4,7 +4,12 @@
  * full text of the license. */
 
 var OpenLayers = {
-    singleFile: true
+    singleFile: true,
+    _getScriptLocation: (function() {
+        var s = document.getElementsByTagName('script');
+        var l = s[s.length-1].getAttribute("src").match(/(^|(.*?\/))(OpenLayers\.js)(\?|$)/)[1];
+        return (function() { return l; });
+    })()
 };
 
 
Index: lib/OpenLayers.js
===================================================================
--- lib/OpenLayers.js	(revision 10821)
+++ lib/OpenLayers.js	(working copy)
@@ -14,15 +14,12 @@
      * Before creating the OpenLayers namespace, check to see if
      * OpenLayers.singleFile is true.  This occurs if the
      * OpenLayers/SingleFile.js script is included before this one - as is the
-     * case with single file builds.
+     * case with old single file build profiles that included both
+     * OpenLayers.js and OpenLayers/SingleFile.js.
      */
     var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
     
-    /**
-     * Cache for the script location returned from
-     * OpenLayers._getScriptLocation
-     */
-    var scriptLocation;
+    var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";
     
     /**
      * Namespace: OpenLayers
@@ -34,7 +31,7 @@
          * Property: _scriptName
          * {String} Relative path of this script.
          */
-        _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
+        _scriptName: scriptName,
 
         /**
          * Function: _getScriptLocation
@@ -43,26 +40,12 @@
          * Returns:
          * {String} Path to this script
          */
-        _getScriptLocation: function () {
-            if (scriptLocation != undefined) {
-                return scriptLocation;
-            }
-            scriptLocation = "";            
-            var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
-         
-            var scripts = document.getElementsByTagName('script');
-            for (var i=0, len=scripts.length; i<len; i++) {
-                var src = scripts[i].getAttribute('src');
-                if (src) {
-                    var match = src.match(isOL);
-                    if(match) {
-                        scriptLocation = match[1];
-                        break;
-                    }
-                }
-            }
-            return scriptLocation;
-        }
+         _getScriptLocation: (function() {
+             var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
+             var s = document.getElementsByTagName('script');
+             var l = s[s.length-1].getAttribute("src").match(r)[1];
+             return (function() { return l; });
+         })()
     };
     /**
      * OpenLayers.singleFile is a flag indicating this file is being included
