fixed bugs in template
fixed some in template