fix getAnchoredMid, improve test