added change to rand and small fix