bugfixes, including a nasty unicode related bug