fix middleware and filter