Fixed the normalization function