diff --git a/pae2xml.pl b/pae2xml.pl
index c0ed6997d2af18b96ac5412ba4109349e48dd820..060d1ab7c8bad762007f6ed0bb6ff161c09d097e 100755
--- a/pae2xml.pl
+++ b/pae2xml.pl
@@ -193,8 +193,6 @@ sub parse_notes {
   $notes =~ s/(\.|\d|\,|\')qq/qq$1/gs; # pull beginning mark of group of grace notes in front of corresponding notes
   $notes =~ s/(xx|x|bb|b|n)qq/qq$1/gs;  # qq first, then parts of notes
 
-  $notes =~ s/\=(\d)/$1/gs; # replace multibar rests #n with just n
-
   while ($notes ne "") {
     if ($notes =~ /^(\'+|\,+)(.*)$/) {  # Octave marks
       ($oct, $notes) = ($1, $2);
@@ -205,13 +203,23 @@ sub parse_notes {
     } elsif ($notes =~ /^r(.*)$/) {  # End grace
       $notes = $1;
       $qq = 0;
-    } elsif ($notes =~ /^(\d+|\=)(\/.*)$/) {  # normal and multi-measure rests
+    } elsif ($notes =~ /^\=(\d*)(\/.*)$/) {  # multi-measure rests
       $measrest = $1;
       $notes = $2;
-      if ($measrest eq '=') {
+      if ($measrest eq '') {
 	$measrest = 1;
       }
       $toprint .= "$measrest measures of rest.\n";
+      if ($measrest > 0) {
+        # Create a real multi-bar rest
+        print OUT '			<attributes>
+				<measure-style>
+					<multiple-rest>'.$measrest.'</multiple-rest>
+				</measure-style>
+			</attributes>
+';
+      }
+      # Now create the measures
       for $n (1..$measrest) {
 	print OUT '			<note>
 				<rest />
diff --git a/sample_files/Rests-multimeasure.pae b/sample_files/Rests-multimeasure.pae
new file mode 100644
index 0000000000000000000000000000000000000000..f0c01ade7805d474e57fd6f7a0670403f24632e6
--- /dev/null
+++ b/sample_files/Rests-multimeasure.pae
@@ -0,0 +1,7 @@
+Test Composer
+Test case for multi-measure rests
+1.1.1: S Multi-measure rests
+plain&easy: %C-1@c$bB� '=/2AB/=3/=/2AB/=15/2AB/
+
+Test Library
+00000000
\ No newline at end of file