Fixed a small bug with collision detection.