sdag: simplify some logic