fix bugs when exporting modules