Cleaned up/fixed error handling around region exporting
added unit tests