generatePerturbations fix