fix for directory creation

Found a bug i missed at first. The directories are now created _after_ the directory names are set in stone.