Corrected NaN bug.