Fixes template check once and for all. Tested.