Issue #8816 by tj, added patch to exclude hook
Issue #8816 by tj, added template patch