fixed up collision detection