Bug fix to directory creation