Fix 16 bit integer typecasts