updated dirname resolution