replace command module running mktemp with tempfile module