fix middleware links