Fix tiny bug in middleware.js