Made middlewares optionally an array