In 766, Ma Lin () replaced Bai as the military governor of Binning. Duan continued to serve as his deputy. It was said that whenever Ma made wrong decisions, Duan would argue with him about it and would not leave until Ma changed his mind. On one occasion, Ma became angry and threatened to kill Duan when Duan insisted, but Duan did not fear the threats, stating, "Why get angry about executing me if I deserve execution? If, on the other hand, I do not deserve execution, then you are unjust." Ma stormed out, but subsequently invited Duan to a feast to apologize. It was said that because of Duan's counsel, Ma received excellent reputation while governing Binning.