be more robust on dir names