Fix #24: serialization corner cases.