Update middleware.py

Same again