fixed an error in algorithm 3