Added tests for the serializer/deserializer.
More serializer test cases, and fixes.
The serializer and deserializer handles (circular) references.