+Binary files bwa/QSufSort.o and bwa-mod/QSufSort.o differ
+Binary files bwa/bamlite.o and bwa-mod/bamlite.o differ
+Binary files bwa/bntseq.o and bwa-mod/bntseq.o differ
+Binary files bwa/bwa and bwa-mod/bwa differ
+Binary files bwa/bwa.o and bwa-mod/bwa.o differ
 diff -rupN -x Xcode -x .git bwa/bwamem.c bwa-mod/bwamem.c
 --- bwa/bwamem.c	2015-07-08 13:14:28.000000000 -0400
-+++ bwa-mod/bwamem.c	2015-08-16 20:10:52.000000000 -0400
-@@ -942,6 +942,32 @@ void mem_aln2sam(const mem_opt_t *opt, c
++++ bwa-mod/bwamem.c	2015-08-28 15:12:12.000000000 -0400
+@@ -942,6 +942,39 @@ void mem_aln2sam(const mem_opt_t *opt, c
  		for (i = tmp; i < str->l; ++i) // replace TAB in the comment to SPACE
  			if (str->s[i] == '\t') str->s[i] = ' ';
  	}
 +	if ((p->flag & 4) == 0) {
 +		kputsn("\tZT:Z:", 6, str);
++		kputs((char*)(p->cigar + p->n_cigar), str);
++		kputc(',', str);
 +		kputw(p->score, str); // same as AS:i
 +		kputc(',', str);
 +		if(p->sub >= 0) {
-+			kputw(p->sub, str);
++			kputw(p->score - p->sub, str);
 +		} else {
 +			kputsn("NA", 2, str);
 +		}
 +		kputc(',', str);
 +		kputw(p->pair_score, str);
 +		kputc(',', str);
-+		kputw(p->pair_sub, str);
++		if(p->pair_sub >= 0) {
++			assert(p->pair_score >= p->pair_sub);
++			kputw(p->pair_score - p->pair_sub, str);
++		} else {
++			kputsn("NA", 2, str);
++		}
 +		kputc(',', str);
 +		kputw(p->sub_n, str);
 +		kputc(',', str);

 		for (i = 0; i < n_aa[0]; ++i)
 			mem_aln2sam(opt, bns, &str, &s[0], n_aa[0], aa[0], i, &h[1]); // write read1 hits
 		s[0].sam = strdup(str.s); str.l = 0;

 } mem_aln_t;
 
 #ifdef __cplusplus
Binary files bwa/bwamem.o and bwa-mod/bwamem.o differ
Binary files bwa/bwamem_extra.o and bwa-mod/bwamem_extra.o differ
diff -rupN -x Xcode -x .git bwa/bwamem_pair.c bwa-mod/bwamem_pair.c
--- bwa/bwamem_pair.c	2015-07-08 13:14:28.000000000 -0400
+++ bwa-mod/bwamem_pair.c	2015-08-06 16:18:28.000000000 -0400
