fix NaN error because of normalizing with zero.