corrected collision detection