#3 Added more robust hack to hook into directory creation.