[WIP] Fix issue 12285, issue 12230

https://d.puremagic.com/issues/show_bug.cgi?id=12285
https://d.puremagic.com/issues/show_bug.cgi?id=12230

This fixes some inconsistencies with template alias parameters (12230) while avoiding breaking code (12230).