various fixes to Blocks and TemplateRule