Fix error in middleware.js