TC: fixed bug processing ScalarRef templates (for error check)