diff --git a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
index d8c67b9ad2cf54da5498047c7f536694301a5c2e..4d5a1c2c2fd0aa458f005c5701296192d843dac5 100644
--- a/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
+++ b/misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
@@ -1103,6 +1103,8 @@ sub parse_mappings {
       chomp();
       my ($label, $query_id, $target_id, $identity, $query_length, $target_length, $query_start, $query_end, $target_start, $target_end, $cigar_line, $score) = split(/:/, $_);
       $cigar_line =~ s/ //g;
+      $cigar_line =~ s/([MDI])(\d+)/$2$1/ig;
+
 
       if($query_id == 138110 || $query_id == 523601){
 	print "processing $query_id\n";