better error handling and messages in export.py