fix bugs of templates, create unit tests for it, 1.0.4.14