Fixed a bug that made the collision detection sometin=mes cause crashes