replace calls to deprecated get_context_instance()