diff --git a/salt/grains/fx2.py b/salt/grains/fx2.py
index <HASH>..<HASH> 100644
--- a/salt/grains/fx2.py
+++ b/salt/grains/fx2.py
@@ -24,11 +24,8 @@ GRAINS_CACHE = {}
 
 
 def __virtual__():
-    try:
-        if salt.utils.platform.is_proxy() and __opts__['proxy']['proxytype'] == 'fx2':
-            return __virtualname__
-    except KeyError:
-        pass
+    if salt.utils.platform.is_proxy() and 'proxy' in __opts__ and __opts__['proxy'].get('proxytype') == 'fx2':
+        return __virtualname__
     return False
 
 
diff --git a/salt/grains/marathon.py b/salt/grains/marathon.py
index <HASH>..<HASH> 100644
--- a/salt/grains/marathon.py
+++ b/salt/grains/marathon.py
@@ -14,10 +14,9 @@ __virtualname__ = 'marathon'
 
 
 def __virtual__():
-    if not salt.utils.platform.is_proxy() or 'proxy' not in __opts__:
-        return False
-    else:
+    if salt.utils.platform.is_proxy() and 'proxy' in __opts__ and __opts__['proxy'].get('proxytype') == 'marathon':
         return __virtualname__
+    return False
 
 
 def kernel():
fix proxy virtual checks for marathon and fx2