--- a/src/c/pathname.d
+++ b/src/c/pathname.d
@@ -222,7 +222,7 @@
                                 cl_object next = ECL_CONS_CDR(ptr);
                                 ptr = ecl_nthcdr(i-2, directory);
 				ECL_RPLACD(ptr, next);
-                                i--;
+                                i = i-2;
                         }
 		} else if (item == @':up') {
 			if (i == 0)