Fix uninstall problem and undefined variable error.