corrected NaN bug with collisions