Small encoding fixes