fixing genetic algorithm