Index: branches/New Persistence Exploration/Persistence/Persistence/PersistenceManager.cs
===================================================================
--- branches/New Persistence Exploration/Persistence/Persistence/PersistenceManager.cs	(revision 1275)
+++ branches/New Persistence Exploration/Persistence/Persistence/PersistenceManager.cs	(revision 1276)
@@ -221,14 +221,30 @@
   }
 
-  public class DeSerializer {    
-
-    class AccessibleObject {
+  public class DeSerializer {
+
+    interface IAccessibleObject {
+      object Obj { get; }
+    }
+
+    class CustomObject : IAccessibleObject {
+      public object Obj { get { return this.obj; } }
+      private object obj;
+      public List<object> customValues;
+      public CustomObject(object obj) {
+        this.obj = obj;
+        this.customValues = new List<object>();
+      }
+      public void AddValue(object value) {
+        customValues.Add(value);
+      }
+    }
+
+    class CompositeObject : IAccessibleObject{
+      public object Obj { get { return this.obj; } }
       public object obj;
       public Dictionary<string, DataMemberAccessor> accessorDict;
-      public List<object> customValues;
-      public AccessibleObject(object obj, Dictionary<string, DataMemberAccessor> accessorDict) {
+      public CompositeObject(object obj, Dictionary<string, DataMemberAccessor> accessorDict) {
         this.obj = obj;
-        this.accessorDict = new Dictionary<string, DataMemberAccessor>();
-        this.customValues = new List<object>();
+        this.accessorDict = new Dictionary<string, DataMemberAccessor>();        
         foreach (KeyValuePair<string, DataMemberAccessor> pair in accessorDict) {
           this.accessorDict.Add(
@@ -238,11 +254,8 @@
       }
       public void SetValue(string name, object value) {
-        if (name == "") {
-          customValues.Add(value);
-        } else {
-          accessorDict[name].Set(value);
-        }
+        accessorDict[name].Set(value);        
       }
       public void SetAllDefaultValues() {
+        throw new NotImplementedException();
       }
     }
@@ -252,5 +265,5 @@
     private Dictionary<int, object> id2obj;
     private Dictionary<Type, Handler> handlers;
-    private Stack<AccessibleObject> compositeStack;    
+    private Stack<IAccessibleObject> compositeStack;    
 
     private Dictionary<Type, IPrimitiveSerializer> primitiveSerializers;
@@ -259,5 +272,5 @@
     public DeSerializer() {
       id2obj = new Dictionary<int, object>();
-      compositeStack = new Stack<AccessibleObject>();
+      compositeStack = new Stack<IAccessibleObject>();
       handlers = new Dictionary<Type, Handler>();
       handlers.Add(typeof(CompositeStart), new Handler(CompositeStartHandler));
@@ -278,5 +291,5 @@
         handlers[token.GetType()].Invoke(token);
       }
-      return compositeStack.Pop().obj;
+      return compositeStack.Pop().Obj;
     }
     private void CompositeStartHandler(IParseToken token) {
@@ -284,7 +297,7 @@
       object instance = null;
       if (this.FindCustomSerializer(start.Type) != null) {
-        instance = null;
-        compositeStack.Push(new AccessibleObject(null, new Dictionary<string, DataMemberAccessor>()));
-        id2obj.Add(start.Id, null);
+        instance = new object();
+        compositeStack.Push(new CustomObject(instance));
+        id2obj.Add(start.Id, instance);
         // TODO: add warning proxy
       } else {
@@ -292,17 +305,18 @@
         Dictionary<string, DataMemberAccessor> accessorDict =
         StorableAttribute.GetAutostorableAccessors(instance);
-        compositeStack.Push(new AccessibleObject(instance, accessorDict));
+        compositeStack.Push(new CompositeObject(instance, accessorDict));
         id2obj.Add(start.Id, instance);
       }
     }
     private void CompositeEndHandler(IParseToken token) {
-      CompositeEnd end = (CompositeEnd)token;
-      AccessibleObject accessibleObject = compositeStack.Pop();
+      CompositeEnd end = (CompositeEnd)token;      
       ICustomSerializer customSerializer = this.FindCustomSerializer(end.Type);
       if (customSerializer != null) {
+        CustomObject customObject = (CustomObject)compositeStack.Pop();  
         this.SetValue(end.Name,
-          customSerializer.DeSerialize(accessibleObject.customValues, end.Type));
+          customSerializer.DeSerialize(customObject.customValues, end.Type));
       } else {
-        this.SetValue(end.Name, accessibleObject.obj);
+        CompositeObject compositeObject = (CompositeObject)compositeStack.Pop();
+        this.SetValue(end.Name, compositeObject.obj);
       }
     }
@@ -329,7 +343,12 @@
     private void SetValue(string name, object value) {
        if (compositeStack.Count == 0) {
-        compositeStack.Push(new AccessibleObject(value, new Dictionary<string,DataMemberAccessor>()));
-      } else {
-        compositeStack.Peek().SetValue(name, value);
+        compositeStack.Push(new CompositeObject(value, new Dictionary<string,DataMemberAccessor>()));
+       } else {
+         object accessibleObject = compositeStack.Peek();
+         if ( accessibleObject is CompositeObject ) {
+           ((CompositeObject)accessibleObject).SetValue(name, value);
+         } else if (accessibleObject is CustomObject) {           
+           ((CustomObject)accessibleObject).AddValue(value);
+         }
       }      
     }
