fixed a nasty bash array bug in MergeBam and some minor changes