Perl template fix and trivial fix