support for middlewares array trees