fixed a bug about duplicate trajectories