Fixing the error with export to excel