Fixes middlewares to work with Context