fixes random generator