bugfix: put end-of-screen handling back into the collision detection
code