     const genome_string         genome,
           Stats&                stats)
 {
-    const uint32 Q = qgram_index.Q;
-
     typedef typename qgram_index_type::system_tag system_tag;
 
     // prepare some vectors to store the query qgrams
     nvbio::vector<system_tag,uint64>  qgrams( n_queries );
     nvbio::vector<system_tag,uint64>  sorted_qgrams( n_queries );
     nvbio::vector<system_tag,uint32>  sorted_indices( n_queries );
+
+    const uint32 Q = qgram_index.Q;
 
     Timer timer;
     timer.start();


    const uint32 batch_size = 16*1024*1024;

    typedef QGramFilter<system_tag,qgram_index_type,const uint64*,const uint32*> qgram_filter_type;

    typedef typename qgram_filter_type::hit_type        hit_type;
    typedef typename qgram_filter_type::diagonal_type   diagonal_type;



// perform q-gram index mapping
//
template <typename qgram_index_type, typename qgram_filter_type, typename genome_string>
void map(
          qgram_index_type&     qgram_index,
          qgram_filter_type&    qgram_filter,
    const io::ReadDataDevice&   reads,
    const uint32                n_queries,
    const uint32                genome_len,
