Fix for issue #28 : TypeInfo mishandling

Looks like TypeInfo handling on serialization was actually rather broken, and only worked with some hackery. It should be fixed now.