fixed random number bug