added logging message on bad encode