fix template.pm and add template.t