Fixed a bug, caused by wrong conversion between signed and unsigned chars.