Handle dependencies a little differently to avoid dangling references and make sure to use the revision, not the wiring, to clean up dependencies. (FELIX-2950)