clean up process invoke middleware