fix div by zero warnings caused by bad marginals