Arithmetic bug fix