Correct encoder/decoder state mismatch and spurious state resetting in the encoder...