Preserve colors from segment editor node and export it as Nifti LabelMap

This came up recently in this thread. This is the important sentence from the documentation:

The label value is index of the color table entry that has the same name as the segment name.

Do you have entries called 31 and 307 in your custom color table?