utf8 fixes, several other improvements/fixes