fix bugs in unicode functions