Make sure original context is maintained and not the deep extended one. Fixes #5924.