fix bug in directory creation