Fix an issue where this can produce a NaN error.