small fixes to random