want to fix optimization to run in temp dir