diff --git a/dist/index.js b/dist/index.js
index 137fdf7..85179f2 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -6275,11 +6275,11 @@ function getMultiPathLCA(searchPaths) {
     // Loop over all the search paths until there is a non-common ancestor or we go out of bounds
     while (splitIndex < smallestPathLength) {
         if (!isPathTheSame()) {
-            // if all are the same, add to the end result & increment the index
-            commonPaths.push(splitPaths[0][splitIndex]);
-            splitIndex++;
             break;
         }
+        // if all are the same, add to the end result & increment the index
+        commonPaths.push(splitPaths[0][splitIndex]);
+        splitIndex++;
     }
     return path.join(...commonPaths);
 }
diff --git a/src/search.ts b/src/search.ts
index bfc21fa..f507f40 100644
--- a/src/search.ts
+++ b/src/search.ts
@@ -67,11 +67,11 @@ function getMultiPathLCA(searchPaths: string[]): string {
   // Loop over all the search paths until there is a non-common ancestor or we go out of bounds
   while (splitIndex < smallestPathLength) {
     if (!isPathTheSame()) {
-      // if all are the same, add to the end result & increment the index
-      commonPaths.push(splitPaths[0][splitIndex])
-      splitIndex++
       break
     }
+    // if all are the same, add to the end result & increment the index
+    commonPaths.push(splitPaths[0][splitIndex])
+    splitIndex++
   }
   return path.join(...commonPaths)
 }