Reset max_id in a better hook