correct a random generate bug