Replace deprecated calls to get_context_instance()