fix Issue 8504 - Template attribute inferrence doesn't work
Need more hack for bug 7757