corrected defect when directory exists