Fix truncation of generated templates