Fix compiler errors.
Add serialization tests.