Fix apt purge

First of all, purging was altogether broken, that's now fixed.

But these changes also let APT deal with removed-but-not-purged packages later. This wasn't the case, as the package would no longer be installed, and so the apt module wouldn't do anything, even if `purge=yes` was set.