corrected error in normalization function