fix fromString and toString for char and unsigned char; clean up code