Fixed BAM header bugs + other small changes.