Changed the place of output normalization.