Fix threading issues for export