Fixed hanging on Middleware