Fix bug with RNG