added initial export, fixed bug in import