fixed an error with insert flag, fixed a bam error