Fix sign bit bugs