Fix category-next-id and its tests.