Be more careful in using provided_context as serialized context.
This addresses issue #15