Fixed some errors in the export functions