Fix bugs and add configure environment in reset.sh