fixed various android bugs, use unsigned char