added preview button in trajectories, which works but still buggy with some trajectories
fixed bug with end of trajectories