Fix regression in apt module

This fixes a regression introduced in bd72e44. Resolves #7257.