Index: libspi/collection.c
===================================================================
--- libspi/collection.c	(revision 905)
+++ libspi/collection.c	(working copy)
@@ -46,7 +46,7 @@
 };
 
 #define MATCH_RULE_PRIVATE(o)\
-     G_TYPE_INSTANCE_GET_PRIVATE((o), SPI_MATCHRULE_TYPE, MatchRulePrivate)
+     G_TYPE_INSTANCE_GET_PRIVATE ((o), SPI_COLLECTION_TYPE, MatchRulePrivate)
 
 
 SpiCollection *
@@ -61,18 +61,17 @@
 
 }
 
-/*
+
 static SpiCollection *
 get_collection_from_servant (PortableServer_Servant servant)
 {
      SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
-
+     
      g_return_val_if_fail (object, NULL);
      
-     return SPI_COLLECTION (object->gobj);
+     return SPI_COLLECTION (object);
 				
 }
-*/
 
 static Accessibility_MatchRule 
 impl_createMatchRule (PortableServer_Servant servant,
@@ -90,7 +89,7 @@
      Accessibility_MatchRule  retval = NULL;
 
      SpiMatchrule *matchrule = spi_matchrule_interface_new ();
-     MatchRulePrivate *mrp   = MATCH_RULE_PRIVATE (matchrule);
+     MatchRulePrivate *mrp   = MATCH_RULE_PRIVATE (get_collection_from_servant (servant));
      int i;
 
      mrp->states  = states;
@@ -128,7 +127,7 @@
      mrp->interfacematchtype = interfacematchtype;
 
      mrp->invert = invert;
-     
+
      retval = CORBA_Object_duplicate (BONOBO_OBJREF (matchrule), ev);
 
      return retval;
@@ -140,18 +139,16 @@
 				CORBA_Environment *ev){
 
      SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
-     SpiMatchrule *spimatchrule;
+     SpiCollection *spimatchrule;
 
      MatchRulePrivate *mrp;  
 
-     spimatchrule = SPI_MATCHRULE (object->gobj);
+     spimatchrule = SPI_COLLECTION (object);
      mrp =  MATCH_RULE_PRIVATE (spimatchrule);;
      
      CORBA_free (mrp->attributes);
      CORBA_free (mrp->roles);
-     CORBA_free (mrp->interfaces);     
-     
-     g_free (spimatchrule);
+     CORBA_free (mrp->interfaces);
 
 }
 static void
Index: libspi/accessible.c
===================================================================
--- libspi/accessible.c	(revision 905)
+++ libspi/accessible.c	(working copy)
@@ -628,10 +628,13 @@
         bonobo_object_add_interface (bonobo_object (retval),
 				     BONOBO_OBJECT (spi_streamable_interface_new (o)));
       }
-    if (ATK_IS_DOCUMENT (o))
-      {
-	bonobo_object_add_interface (bonobo_object (retval),
-	                             BONOBO_OBJECT (spi_document_interface_new (o)));
+    if (ATK_IS_DOCUMENT (o)) /* We add collection interface to document */
+      { 
+	   SpiDocument *doc = spi_document_interface_new (o);
+	   bonobo_object_add_interface (BONOBO_OBJECT (doc), 
+					BONOBO_OBJECT (spi_collection_interface_new ()));
+	   bonobo_object_add_interface (bonobo_object (retval),
+					BONOBO_OBJECT (doc));
       }
     if (ATK_IS_HYPERLINK_IMPL (o))
       {
Index: atk-bridge/bridge.c
===================================================================
--- atk-bridge/bridge.c	(revision 905)
+++ atk-bridge/bridge.c	(working copy)
@@ -40,6 +40,7 @@
 #include "remoteobject.h"
 #include "accessible.h"
 #include "application.h"
+#include "collection.h"
 #include <bonobo-activation/bonobo-activation-register.h>
 
 #undef SPI_BRIDGE_DEBUG
@@ -330,6 +331,8 @@
   Accessibility_Registry_registerApplication (spi_atk_bridge_get_registry (),
                                               BONOBO_OBJREF (this_app),
                                               &ev);
+  bonobo_object_add_interface (bonobo_object (this_app),
+			       BONOBO_OBJECT (spi_collection_interface_new ()));
   bridge_threads_enter ();
   if (ev._major != CORBA_NO_EXCEPTION)
     CORBA_exception_free (&ev);
