clean up header management in metadata template gen