error in template handling fixed