changed min_id to max_tag_id