     const uint32 n_hits = qgram_filter.rank(
         qgram_index,
         n_queries,
-        nvbio::plain_view( sorted_qgrams ),
-        nvbio::plain_view( sorted_indices ) );
+        nvbio::raw_pointer( sorted_qgrams ),
+        nvbio::raw_pointer( sorted_indices ) );
+
+    if (n_hits != n_occurrences)
+    {
+        log_error(stderr, "  mismatching number of hits: expected %u, got %u\n", n_occurrences, n_hits);
+        exit(1);
+    }
 
     // loop through large batches of hits and locate them
     for (uint32 hits_begin = 0; hits_begin < n_hits; hits_begin += batch_size)

        sorted_qgrams.begin(),
        sorted_qgrams.begin() + n_queries,
        ranges.begin(),
        nvbio::plain_view( qgram_index ) );

    cudaDeviceSynchronize();
    timer.stop();

        qgrams.begin(),
        qgrams.begin() + n_queries,
        ranges.begin(),
        nvbio::raw_pointer( qgram_index ) );

    cudaDeviceSynchronize();
    timer.stop();
