Work around COOK-2171

Tested with apt-1.8.0 and apt-1.8.2
fixes #40 and fixes #41
Merge pull request #42 from DataDog/apt-18-workaround

Work around COOK-2171