Fix 'latest' for archived packages

It points to the last version. Also fix tests.