Misc fixes trying to get random to work

Has been failing with weird segfaults; hunting them down