Fix an issue with replacing losing categories.