fixes to check output directory existence