Fix bugs in trail collosion detection.