fixed process exception in middleware