gapMin calculation correcting