fixed bug in template writer on sample path for QC