a very slow script to split bam to sam files