constructor for decode