Reorder middlewares fixes #2