added restore upstream func