Minor fixes to tpl

And fixes few own mistakes on the go