template engine bugfix