change decode to encode