More tweaks to the uninstall script for it to work in Jenkins.