fix integer overflow in updates