framework.js & middleware.js modified