         assert(candidate_first_match_thread != threadIdx.x || match_found);
         assert(!match_found || candidate_first_match_thread <= threadIdx.x);
 
-        if (match_location == length || candidate_first_match_thread < first_match_thread) {
+        if (candidate_first_match_thread < first_match_thread) {
           // if we found a valid match, and it occurs before a previously found
           // match, use that
           first_match_thread = candidate_first_match_thread;
           hashPos = __shfl_sync(0xffffffff, hashPos, first_match_thread);
-          match_location = hashTable[hashPos];
+          match_location
+              = convertIdx(hashTable[hashPos], decomp_idx + first_match_thread);
         }
       }
 

  int mask = 0;

  // full search
  for (int d = 1; d < 32; ++d) {
    const int nbr_id = (threadIdx.x + d) & 31;
    mask |= (val == __shfl_sync(participants, val, nbr_id)) << nbr_id;


        // comunicate the global position of the match to other threads
        match_location = __shfl_sync(0xffffffff, match_location, first_match_thread);
      } else {
        first_match_thread = COMP_THREADS;
      }

      // only go to the hash table, if there is a possibility of a finding an
