improve, can calculate b smaller than set