fix infinite loop for absolute pathnames