fixed template bug with jquery