corrections in middleware