     snp_filter_context& snp = context->snp_filter;
 
     // compute the VCF ranges for each read
-    snp.active_vcf_ranges.resize(context->read_order.size());
     thrust::for_each(context->read_order.begin(),
                      context->read_order.end(),
+    snp.active_vcf_ranges.resize(batch.crq_index.size());
                      compute_vcf_ranges(*context, batch));
 
     // build a list of reads with active VCF ranges

        : bqsr_lambda(ctx, batch)
    { }

    NVBIO_HOST_DEVICE void operator() (const uint32 read_id)
    {
        const uint32 read_index = ctx.read_order[read_id];

        const BAM_CRQ_index& idx = batch.crq_index[read_index];
        const uint16 *offset_list = &ctx.snp_filter.read_offset_list[idx.read_start];
        uint2& output = ctx.alignment_windows[read_index];

        : bqsr_lambda(ctx, batch)
    { }

    NVBIO_HOST_DEVICE void operator() (const uint32 read_index)
    {
        const BAM_CRQ_index& idx = batch.crq_index[read_index];

        const BAM_cigar_op *cigar = &batch.cigars[idx.cigar_start];
