diff --git a/rsvg-filter.c b/rsvg-filter.c
index 705f14c..0940b87 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -2110,7 +2110,7 @@ rsvg_filter_primitive_component_transfer_render (RsvgFilterPrimitive *
                 }
         }
         if (i == self->super.children->len)
-            functions[c] = identity_component_transfer_func;
+            functions[ctx->channelmap[c]] = identity_component_transfer_func;
 
     }
 
@@ -2139,6 +2139,7 @@ rsvg_filter_primitive_component_transfer_render (RsvgFilterPrimitive *
                 } else
                     inval = inpix[c];
 
+                g_assert(functions[c]!=NULL);
                 temp = functions[c] (inval, channels[c]);
                 if (temp > 255)
                     temp = 255;
