rewrite rest_visit_stats