Possibly fixed the unhandled exception

Changed the collision detection code a bit, it should cause problematic
entities to jump to the edge of the screen, but I haven't seen it
happen.  Hopefully it works.