finish Middleware