fixed the random method