rewrite template removed & bug fixed