     baq.hmm_reference_windows.resize(batch.device.num_reads);
     baq.bandwidth.resize(batch.device.num_reads);
 
-    // compute the alignment frames
+    // compute the HMM windows
     // note: this is used both for real BAQ and flat BAQ, so we use the full active read list
     parallel<system>::for_each(context.active_read_list.begin(),
                                context.active_read_list.end(),
                                compute_hmm_windows<system>(context, batch.device));
+
+    // remove any reads for which we failed to compute the HMM window
+    temp_active_list.resize(active_baq_read_list.size());
+    num_active = parallel<system>::copy_if(active_baq_read_list.begin(),
+                                           active_baq_read_list.size(),
+                                           temp_active_list.begin(),
+                                           hmm_window_valid<system>(context, batch.device),
+                                           context.temp_storage);
+    active_baq_read_list = temp_active_list;
+    active_baq_read_list.resize(num_active);
+
+    temp_active_list.resize(context.active_read_list.size());
+    num_active = parallel<system>::copy_if(context.active_read_list.begin(),
+                                           context.active_read_list.size(),
+                                           temp_active_list.begin(),
+                                           hmm_window_valid<system>(context, batch.device),
+                                           context.temp_storage);
+    context.active_read_list = temp_active_list;
+    context.active_read_list.resize(num_active);
 
 #if ENABLE_LMEM_PATH
     if (!baq_use_lmem)


    CUDA_HOST_DEVICE void operator() (const uint32 read_index)
    {
        const CRQ_index idx = batch.crq_index(read_index);

        const ushort2& read_window_clipped = ctx.cigar.read_window_clipped[read_index];

    struct baq_context<system>& baq = context.baq;
    vector<system, uint32>& active_baq_read_list = context.temp_u32;
    vector<system, uint32>& baq_state = context.temp_u32_2;
    vector<system, uint32>& temp_active_list = context.temp_u32_3;

    // check if we can use the lmem kernel
#if ENABLE_LMEM_PATH
