change buffer type from char to unsigned char, removed the 0xffffffXX caused by negative sign