restored the collision detection