Fix encoder_state_init, which was making out of bound reads