Fixed some bugs related to text export.