fixed bug in genetic algorithm