Moved export error-checking code.