export template encoding + layout fixes