import/export module: bug fixes and memory improvements