Fix issue in collision detection