bug fixes to export