Fix orphan packages when using the external solver