Fix the encoder

Change-Id: I929c769b24d0b891487faf4f0d3c9fa66e04eeef