Fixing upcasting behaviour for some operations on integers.