Fix #752.  When total == 0, the scale should also be 0, to avoid log(0).