Middleware related fix