Fix optimized arithmetic