Fixed division by zero for swap_total