 #endif  // USE_MERSENNE_TWISTER
 
         unsigned int rand = _find_poisson_maxk32( s_pois_cdf, x, max_k );
-        __syncthreads();
 
 #ifdef LOG_RANDOM_EVENTS
         evt_list[tid] = rand;
         evt_list += XOVER::BLOCKS_PER_KERNEL * XOVER::THREADS_PER_BLOCK;
 #endif  // LOG_RANDOM_EVENTS
+        __syncthreads();
 
         for( i = 1; i < 32; i <<= 1 ) {
             unsigned int r = __shfl_up( rand, i );

        i = tid;
        while( i < nAlleles ) {
#ifdef USE_TEXTURE_MEMORY_FOR_ALLELE
            real_type _allele = tex1Dfetch( allele_tex, i );
#else
            real_type _allele = allele_list[ i ];
#endif  // USE_TEXTURE_MEMORY_FOR_ALLELE

            rand = (unsigned int) (_allele * ((real_type)XOVER::THREADS_PER_BLOCK));

            unsigned int e_min = event_hash[ rand++ ];
            _sum = event_hash[ rand ];

            int_type cmask = e_min;

            while( e_min < _sum ) {
                accum = rand_pool[ e_min++ ];
                cmask += ( _allele > accum);
            }
            __syncthreads();

            cmask = ((cmask & 1) * (1 << lane_id));


    evt_list += blockIdx.x * XOVER::THREADS_PER_BLOCK;
#endif  // LOG_RANDOM_EVENTS

    int_type seq_idx = blockIdx.x;
    while( seq_idx < nSequences ) {

        unsigned int * seq = sequences + (seq_idx * sequence_width);
