Fix a bug in the trajectory fragment