Fixes to randomization.