fix middleware test