Bugfixes for integer math.