fix div-by-zero error