diff --git a/Shorewall/Perl/Shorewall/Accounting.pm b/Shorewall/Perl/Shorewall/Accounting.pm
index c7908b9..b0419b5 100644
--- a/Shorewall/Perl/Shorewall/Accounting.pm
+++ b/Shorewall/Perl/Shorewall/Accounting.pm
@@ -227,6 +227,8 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
 	    $target = '';
 	    my @objects = split_list $1, 'nfacct';
 	    $rule .= "-m nfacct --nfacct-name $_ ", $nfobjects{$_} = 1 for @objects;
+	} elsif ( $action eq 'INLINE' ) {
+	    $rule .= get_inline_matches;
 	} else {
 	    ( $action, my $cmd ) = split /:/, $action;
 
diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm
index 4ec5df0..a223608 100644
--- a/Shorewall/Perl/Shorewall/Chains.pm
+++ b/Shorewall/Perl/Shorewall/Chains.pm
@@ -617,7 +617,7 @@ use constant { UNIQUE      => 1,
 our %opttype = ( rule          => CONTROL,
 		 cmd           => CONTROL,
 
-		 dhcp          => UNIQUE,
+		 dhcp          => CONTROL,
 
 		 mode          => CONTROL,
 		 cmdlevel      => CONTROL,
@@ -992,8 +992,12 @@ sub format_rule( $$;$ ) {
     #
     my $ruleref = $rulerefp->{complex} ? clone_rule( $rulerefp ) : $rulerefp;
 
-    for ( @unique_options ) {
-	if ( exists $ruleref->{$_} ) {
+    for ( @{$ruleref->{matches}} ) {
+	my $type = $opttype{$_} || 0;
+	
+	next if $type & ( CONTROL | TARGET );
+
+	if ( $type == UNIQUE ) {
 	    my $value = $ruleref->{$_};
 
 	    $rule .= ' !' if $value =~ s/^! //;
@@ -1003,23 +1007,11 @@ sub format_rule( $$;$ ) {
 	    } else {
 		$rule .= join( '' , ' --', $_, ' ', $value );
 	    }
-	}
-    }
-
-    $rule .= format_option( 'policy',  $ruleref->{policy} )  if defined $ruleref->{policy};
-
-    if ( defined ( my $state = $ruleref->{'conntrack --ctstate'} ) ) {
-	$rule .= format_option( 'conntrack --ctstate' , $state );
-    } elsif ( defined ( $state = $ruleref->{state} ) ) {
-	$rule .= format_option( 'state',   $state );
-    }
 
-    for ( grep ! $opttype{$_}, @{$ruleref->{matches}} ) {
-	$rule .= format_option( $_, pop_match( $ruleref, $_ ) );
-    }
-
-    for ( grep( ( $opttype{$_} || 0 ) == LAST , @{$ruleref->{matches}} ) ) {
-	$rule .= format_option( $_, pop_match( $ruleref, $_ ) );
+	    next;
+	} else {
+	    $rule .= format_option( $_, pop_match( $ruleref, $_ ) );
+	}
     }
 
     if ( $ruleref->{target} ) {
@@ -1075,8 +1067,13 @@ sub merge_rules( $$$ ) {
 
     my $target = $fromref->{target};
 
+    my %added;
+
     for my $option ( @unique_options ) {
-	$toref->{$option} = $fromref->{$option} if exists $fromref->{$option};
+	if ( exists $fromref->{$option} ) {
+	    push( @{$toref->{matches}}, $option ) unless exists $toref->{$option};
+	    $toref->{$option} = $fromref->{$option};
+	}
     }
 
     for my $option ( grep ! $opttype{$_}, keys %$fromref ) {
@@ -6951,7 +6948,7 @@ sub expand_rule( $$$$$$$$$$;$ )
 {
     my ($chainref ,    # Chain
 	$restriction,  # Determines what to do with interface names in the SOURCE or DEST
-	$callersrule,  # Caller's matches that don't depend on the SOURCE, DEST and ORIGINAL DEST
+	$rule,         # Caller's matches that don't depend on the SOURCE, DEST and ORIGINAL DEST
 	$source,       # SOURCE
 	$dest,         # DEST
 	$origdest,     # ORIGINAL DEST
@@ -6971,7 +6968,6 @@ sub expand_rule( $$$$$$$$$$;$ )
     my ( $jump, $mac,  $targetref, $basictarget );
     our @ends = ();
     my $deferdns = $config{DEFER_DNS_RESOLUTION};
-    my $rule = '';
 
     if ( $target ) {
 	( $basictarget, my $rest ) = split ' ', $target, 2;
@@ -7078,7 +7074,7 @@ sub expand_rule( $$$$$$$$$$;$ )
 	#
 	( $rule, $done ) = handle_exclusion( $disposition,
 					     $table,
-					     $rule . $callersrule,
+					     $rule,
 					     $restriction,
 					     $inets,
 					     $iexcl,
@@ -7115,7 +7111,7 @@ sub expand_rule( $$$$$$$$$$;$ )
 		for my $dnet ( split_host_list( $dnets, $deferdns ) ) {
 		    $source_match  = match_source_net( $inet, $restriction, $mac ) unless $globals{KLUDGEFREE};
 		    my $dest_match = match_dest_net( $dnet, $restriction );
-		    my $matches = join( '', $source_match, $dest_match, $onet, $rule, $callersrule );
+		    my $matches = join( '', $rule, $source_match, $dest_match, $onet );
 
 		    my $cond3 = conditional_rule( $chainref, $dnet );
 
