fix bug in template tag