Fix errors for Random generation