fix case where header or record template not defined