fixed bug with random