Bug fix for exporting. Now a working version