How to fix “too many templates” issue