corrected safeNormalize