ticket:3 fix middleware
Merge branch 't3_middleware'