Should initially calculate max_id in special case