[FIX] fixed bug in write bam