Fix bug in patching embedded structures