encoding fixes