fix ensure-directory