changed to unsigned char to make sure it works