tpl improvements and test fixings