Index: /branches/release-30/lib/MT/Template/ContextHandlers.pm
===================================================================
--- /branches/release-30/lib/MT/Template/ContextHandlers.pm (revision 1379)
+++ /branches/release-30/lib/MT/Template/ContextHandlers.pm (revision 1391)
@@ -2315,9 +2315,11 @@
     } elsif (my $app_file = $arg->{name}) {
         # app template include mode
+        my $mt = MT->instance;
+        local $mt->{component} = $arg->{component} if exists $arg->{component};
         my $stash_id = 'template_file::' . $app_file;
         return $ctx->error(MT->translate("Recursion attempt on file: [_1]", $app_file))
             if $include_stack{$stash_id};
         local $include_stack{$stash_id} = 1;
-        my $tmpl = MT->instance->load_tmpl($app_file);
+        my $tmpl = $mt->load_tmpl($app_file);
         if ($tmpl) {
             $tmpl->name($app_file);
@@ -2329,5 +2331,4 @@
                 $tmpl_file = '.' . $tmpl_file;
             }
-            my $mt = MT->instance;
             $mt->run_callbacks('template_param' . $tmpl_file, $mt, $tmpl->param, $tmpl);
 
