Fixed isCollision method