Ensure the max_by sequence is valid