Fixed bugs in UTF-8 routines.