more encoding fixes, really fixes #32