middlewares of main namespace should be called first

When you set middlewares both with and without namespaces, these middleware functions run in parallel. I believe they should run in series. All middlewares of main namespace should be called first.