fix middleware classes