Fix charcode conversions and some unboxing operations