Updated SO version in prep for serialization foramt change
From Lukasz Izdebski , "I added  write and read numInstances in PrimitiveSet."