Fix serialize op return type.
Port a few of the basic serialization primitives.