Fix rate limiter and add test.