improve boundary collisions