FIxed a bug in collision detection.