properly handle update fails when encoding
clean up comments