improved remove and uninstall handling