small optimizations in built-in templates
fix custom template loading for core tests