Fix callback stack mishandling

When decode/encode gets called in a list context (for ex., when constructing lists/hash values), and they uses perl callbacks, stack may get misaligned, that leads to crashes of the perl interpreter.