fix bugs of dividing by zero

1) Change the divide which may caused by divide 0
2) Change samtools to $samtools in line1426