Add title template and fix bugs