putting back the temp dir logic