diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm
index 8e2f51e0a..49097530d 100644
--- a/lib/Slic3r/Fill.pm
+++ b/lib/Slic3r/Fill.pm
@@ -62,7 +62,12 @@ sub make_fill {
         my @surfaces_with_bridge_angle = grep defined $_->bridge_angle, @fill_surfaces;
         
         # give priority to bridges
-        my @groups = Slic3r::Surface->group({merge_solid => 1}, @fill_surfaces);
+        my @groups = Slic3r::Surface->group({
+            bridged_bottom          => ($layerm->id > 0),
+            solid_infill_flow       => $layerm->solid_infill_flow,
+            top_infill_flow         => $layerm->top_infill_flow,
+            solid_fill_pattern      => $layerm->config->solid_fill_pattern,
+        }, @fill_surfaces);
         @groups = sort { defined $a->[0]->bridge_angle ? -1 : 0 } @groups;
         
         foreach my $group (@groups) {
diff --git a/lib/Slic3r/Surface.pm b/lib/Slic3r/Surface.pm
index d0b9ec778..03a48a1dd 100644
--- a/lib/Slic3r/Surface.pm
+++ b/lib/Slic3r/Surface.pm
@@ -21,8 +21,20 @@ sub group {
     
     my %unique_types = ();
     foreach my $surface (@surfaces) {
+        my $stype = $surface->surface_type;
+        if ($surface->is_bridge && ($params->{bridged_bottom} || $surface->surface_type != S_TYPE_BOTTOM)) {
+            $stype = 'bridge';
+        } elsif ($surface->is_solid) {
+            my $fw = $params->{solid_infill_flow};
+            if ($surface->surface_type == S_TYPE_TOP && $params->{top_infill_flow}) {
+                $fw = $params->{top_infill_flow}->width;
+            }
+            my $pattern = $surface->is_external ? $params->{solid_fill_pattern} : 'rectilinear';
+            $stype = join '_', $fw // '', $pattern // '';
+        }
+        
         my $type = join '_',
-            ($params->{merge_solid} && $surface->is_solid) ? 'solid' : $surface->surface_type,
+            $stype,
             $surface->bridge_angle // '',
             $surface->thickness // '',
             $surface->thickness_layers;
@@ -57,6 +69,13 @@ sub is_solid {
         || $type == S_TYPE_INTERNALSOLID;
 }
 
+sub is_external {
+    my $self = shift;
+    my $type = $self->surface_type;
+    return $type == S_TYPE_TOP
+        || $type == S_TYPE_BOTTOM;
+}
+
 sub is_bridge {
     my $self = shift;
     my $type = $self->surface_type;