Fixed errors in signed integers.
Added upcasts for unsigned integers