added NaN test for dot_product