fix bug exporting file handle instead of contents
Merge pull request #376 from lewang/export-actual-file-bug

fix bug exporting file handle instead of contents