Some fixes in alg