diff --git a/tupak/core/sampler.py b/tupak/core/sampler.py
index 9ef04661f30f8483c9b2064fb10e27efd892528c..1e505cf4c83564c10023f147fb2e7d8656dd85c3 100644
--- a/tupak/core/sampler.py
+++ b/tupak/core/sampler.py
@@ -1196,10 +1196,13 @@ class Pymc3(Sampler):
 
                 if distname in self.prior_map:
                     # check if we have a predefined PyMC3 distribution
-                    if 'pymc3' in self.prior_map[distname] and 'argmap' in self.prior_map[distname] and distname in pymc3.__dict__:
+                    if 'pymc3' in self.prior_map[distname] and 'argmap' in self.prior_map[distname]:
                         # check the required arguments for the PyMC3 distribution
                         pymc3distname = self.prior_map[distname]['pymc3']
 
+                        if pymc3distname not in pymc3.__dict__:
+                            raise ValueError("Prior '{}' is not a known PyMC3 distribution.".format(pymc3distname))
+
                         reqargs = inspect.getargspec(pymc3.__dict__[pymc3distname].__init__).args[1:]
 
                         # set keyword arguments