Properly detect overflow in all functions.