fixing middleware setting