[FIX] optimized BAM reading/writing