     nvbio::vector<system_tag,diagonal_type> merged_hits( batch_size );
     nvbio::vector<system_tag,uint16>        merged_counts( batch_size );
     nvbio::vector<system_tag,int16>         scores( batch_size );
+    nvbio::vector<system_tag,uint32>        out_reads( batch_size );
+    nvbio::vector<system_tag,int16>         out_scores( batch_size );
+    nvbio::vector<system_tag,uint8>         temp_storage;
 
     timer.start();
 
     // first step: rank the query q-grams
-    const uint32 n_hits = qgram_filter.rank(
+    const uint64 n_hits = qgram_filter.rank(
         qgram_index,
         n_queries,
         nvbio::plain_view( sorted_qgrams ),

    stats.occurrences += n_hits;

    // loop through large batches of hits and locate & merge them
    for (uint32 hits_begin = 0; hits_begin < n_hits; hits_begin += batch_size)
    {
        const uint32 hits_end = nvbio::min( hits_begin + batch_size, n_hits );

        timer.start();


    const char* reads = argv[argc-1];
    const char* index = argv[argc-2];

    uint32 Q         = 20;
    uint32 Q_intv    = 10;
    bool   rc        = false;
    uint32 max_reads = uint32(-1);

    for (int i = 0; i < argc; ++i)
    {
