Partially reimplement builtin serialization.