bugfix and encoding issues