fixing randrange issue