minireg encoding/decoding working