bugfix on dir handling