Include template hooks early Fixes #3664