fixed the normalize function;