fix bugs where cloned inputs do not get removed