fixed bugs about reopen template.