Fixed generating of directories.