diff --git a/cma.py b/cma.py
index f1a5f4b..2f8fc29 100755
--- a/cma.py
+++ b/cma.py
@@ -2742,7 +2742,9 @@ class CMAEvolutionStrategy(OOOptimizer):
                 print('   Covariance matrix is diagonal' + s)
 
     def _set_x0(self, x0):
-        if x0 == str(x0):
+        if callable(x0):
+            x0 = x0()
+        elif x0 == str(x0):
             x0 = eval(x0)
         self.x0 = array(x0)  # should not have column or row, is just 1-D
         if self.x0.ndim == 2:
