Fix bug in directory creation