Avoid NullReference Exception during export.