 +		        return 0;
 +		}
 +
-+		for (i = 0; i < numdevs; ++i) {
++		for (i = 0; i <= numdevs; ++i) {
 +			ind = (hook_map + i)->dev;
 +			if (ind->owner_env->veid == cur->veid 
 +			    && ind->ifindex != dev->ifindex) {

        kfree(imq_devs);
 }
 
@@ -365,8 +673,14 @@
                printk(KERN_ERR "IMQ: Error trying imq_init_devs()\n");
                return err;
        }
-       if ((err = imq_init_hooks())) {
+       if (build_hook_set(&root_hook_set)) {
+	       printk(KERN_ERR "IMQ: Error trying to build root hook set\n");
+	       imq_cleanup_devs();
+	       return err;
+       }
+       if ((err = imq_init_hooks(root_hook_set,1))) {
                printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
+	       free_hook_set(&root_hook_set);
                imq_cleanup_devs();
                return err;
        }
@@ -389,7 +703,8 @@
 
 static void __exit imq_cleanup_module(void)
 {

        }
 }
 
@@ -150,6 +369,11 @@
 {
        struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
 
