use pushd popd instead of tmp var