I believe the trait ID numbers are assigned by the engine based on the order in which they appear in the relevant text file. Add new traits, or shuffle the order of existing traits, and the ID numbers will change. Probably best to proceed with caution and only add traits to the end of the existing list, in case some of the ID numbers are hardcoded into the engine somewhere.