make this work on platforms with unsigned chars