(CDB) Fix export bug when exporting with relations