Porting small changes to CreateDirectory from coilib50