Middleware not array fix