better error handling in reset.sh