fix per-directory path handling