Fixed encoding issues

This should fix #889 I believe.