fix template engine bug