Index: branches/release-41/lib/MT/CMS/Template.pm
===================================================================
--- branches/release-41/lib/MT/CMS/Template.pm (revision 2707)
+++ branches/release-41/lib/MT/CMS/Template.pm (revision 2715)
@@ -1414,5 +1414,5 @@
         require MT::TemplateMap;
         my @p = $q->param;
-        my @static_maps;
+        my %static_maps;
         for my $p (@p) {
             my $map;
@@ -1428,5 +1428,12 @@
                 $map    = MT::TemplateMap->load($map_id)
                     or next;
-                $map->file_template( $q->param($p) );
+                my $file_template = $q->param($p);
+                my $build_type_1  = $q->param("map_build_type_$map_id");
+                # Populate maps whose build type is dynamic
+                # and file template are changed
+                $static_maps{ $map->id } = 1
+                    if ( ( $file_template ne $map->file_template )
+                      && ( MT::PublishOption::DYNAMIC() eq $build_type_1 ) );
+                $map->file_template( $file_template );
                 $map->save;
             }
@@ -1439,5 +1446,5 @@
                 # Populate maps that are changed from static to dynamic
                 # This should capture new map as well
-                push @static_maps, $map->id
+                $static_maps{ $map->id } = 1
                     if ( ( $build_type ne $map->build_type )
                       && ( MT::PublishOption::DYNAMIC() eq $build_type ) );
@@ -1457,5 +1464,5 @@
             }
         }
-        $app->{static_dynamic_maps} = @static_maps ? \@static_maps : 0;
+        $app->{static_dynamic_maps} = %static_maps ? [ keys %static_maps ] : 0;
     }
 
