alg 2. fixed