Fixed bugs in export.