Fix a bug in directory creation code.