fixed wrapped problem for templates