Fix middle_ware