update both encoder and decoder