[td4] correct algorithm 3