Fix template inheritance and other bugs in offline compression