Update middleware.js