fix bugs and export