Fixed up twos-complement logic