fixes #12

Serialization supports Integer in addition to Long
fixes #11

Fixes a problem in serialization where after meeting a custom type the
root key was not reseted, having the effect to concatenate that key to
the following fields which were not member of the previous field being
serialized. See #11