added setProvider method on guard.