fixing issue with random