decoder and fix in encoder