A couple more fixes for the template machinery