Revert "template engine bug"

This reverts commit 1733a94e47accb493374c771289af2bab3375e4b.
better solution to template engine