         else
             bandWidth = queryLen;
 
-        if (MAX_BAND_WIDTH < abs(referenceLength - queryLen))
+        if (MIN_BAND_WIDTH < abs(referenceLength - queryLen))
         {
             bandWidth = abs(referenceLength - queryLen) + 3;
         }
 
-        if (bandWidth > MAX_BAND_WIDTH)
-            bandWidth = MAX_BAND_WIDTH;
+        if (bandWidth > MIN_BAND_WIDTH)
+            bandWidth = MIN_BAND_WIDTH;
 
         if (bandWidth < abs(referenceLength - queryLen))
         {

        else
            bandWidth = queryLen;

        if (MAX_BAND_WIDTH < abs(referenceLength - queryLen))
        {
            bandWidth = abs(referenceLength - queryLen) + 3;
        }

        if (bandWidth > MAX_BAND_WIDTH)
            bandWidth = MAX_BAND_WIDTH;

        if (bandWidth < abs(referenceLength - queryLen))
        {


// maximum read size for the lmem kernel
#define LMEM_MAX_READ_LEN 151
#define LMEM_MAT_ROW_SIZE (3 * MIN_BAND_WIDTH2 + 6)
#define LMEM_MAT_SIZE ((LMEM_MAX_READ_LEN + 1) * LMEM_MAT_ROW_SIZE)

//#define GUARD_BAND(z) ((z) > 0 ? (z) : 0)
