Fixed bug in RNG