Fix random number problem