     uint32 text_length(const uint32 i, context_type* context) const { return m_text_len; }
 
     // return the total number of cells
-    uint64 cells() const { return size() * uint64( max_pattern_length() ) * uint64( m_text_len ); }
+    uint64 cells() const { return uint64( m_total_pattern_len ) * uint64( m_text_len ); }
 
     // initialize the i-th context
     NVBIO_FORCEINLINE NVBIO_HOST_DEVICE

        const uint32*       _offsets,
        const uint32*       _patterns,
        const uint32        _max_pattern_len,
        const uint32*       _text,
        const uint32        _text_len,
               int16*       _scores) :
        m_aligner           ( _aligner ),
        m_count             (_count),
        m_max_pattern_len   (_max_pattern_len),
        m_text_len          (_text_len),
        m_offsets           (_offsets),
        m_patterns          (_patterns),

                    d_read_data.read_index(),
                    d_read_data.read_stream(),
                    d_read_data.max_read_len(),
                    n_read_symbols,
                    nvbio::plain_view( d_ref_storage ),
                    ref_length,
                    nvbio::plain_view( score_dvec ) );
