add required middleware