Fix bugs in PSO