Middleware, bugfix