Fixed normalize function.