Updated Middleware to forward errors