small fixes for export, and a cleanup for the tmp string