ticket:3. Fixed according to comments
Merge branch 't3_middleware'