improved directory creation