fixing saving context in metadata