Fixed some bugs in RNG generation as well
as sorted previous bug introduced in counts for random effects.