fixed handle_ratelimit function