Fixes for thread in stats and for randomizer