Minor fixes and improvements in BAM converter