Make example serialization code use correct library functions
Merge pull request #387 from rbu/patch-1

Make example serialization code use correct library functions