trying to work on a bug in the collision detection algorithm