fixes corner cases in bam2bam