Improve tail of sb_divappr_q and fix bug.