Fixed a bug in calculating bad fitness