fix static variable in template