serialize context instead of trying to recreate it

**please review** @traiansf please review