Unit test + ab algorithm fix.