Added error handling if output dir doesn't exists