Fixes bug in RNG