r381: fixed a bug when upper bound < max read len
r382: similar treatment in bwa-sw (see r381)