Fixing bug in collision detection code.