Fix arithmetic error