fixed the comparison between singed and unsigned.