fixed ensuredir bug