         }
         else
         {
-            //Remember date object
-            context.addObject(date);
+            rememberObject(context, date);
 
             element = <date />;
             element.appendChild(new XML(date.getTime().toString()));


    }

    private static function encodeObject(xml:XML, obj:*, context:AMFXContext):void
    {
        var ref:int = context.findObject(obj);

                if (context.log)
                    context.log.warn("Cannot serialize type Class");
            }
            else if (obj is Dictionary)
            {
                encodeDictionary(xml, obj as Dictionary, context);
            }
            else
            {
                encodeObject(xml, obj, context);
