diff --git a/loopy/subst.py b/loopy/subst.py
index 5d577fc6af2850797507fac30bf34175825c8501..90c0a79162c77ac1cbd97ac8ffaf12fd8c8c36d0 100644
--- a/loopy/subst.py
+++ b/loopy/subst.py
@@ -229,7 +229,7 @@ class TemporaryToSubstChanger(ExpandingIdentityMapper):
             if result is not None:
                 return result
 
-        return super(ExpandingIdentityMapper, self).map_variable(
+        return super(TemporaryToSubstChanger, self).map_variable(
                 expr, expn_state)
 
     def map_subscript(self, expr, expn_state):
@@ -238,7 +238,7 @@ class TemporaryToSubstChanger(ExpandingIdentityMapper):
             if result is not None:
                 return result
 
-        return super(ExpandingIdentityMapper, self).map_variable(
+        return super(TemporaryToSubstChanger, self).map_subscript(
                 expr, expn_state)
 
     def transform_access(self, index, expn_state):