update export logic in plugin function