better dir handling