Fix bug in export to excel feature