fix middleware signatures