improved directory create code.